Skip to content

Instantly share code, notes, and snippets.

@maninhat
maninhat / README-setup-tunnel-as-systemd-service.md
Created September 2, 2024 18:50 — forked from drmalex07/README-setup-tunnel-as-systemd-service.md
Setup a secure (SSH) tunnel as a systemd service. #systemd #ssh #ssh-tunnel #ssh-forward

README

Create a template service file at /etc/systemd/system/[email protected]. The template parameter will correspond to the name of target host:

[Unit]
Description=Setup a secure tunnel to %I
After=network.target
@maninhat
maninhat / postgresql.yml
Created February 25, 2024 15:28 — forked from greenhat/postgresql.yml
Ansible playbook for PostgreSQL setup
---
- name: install PostgreSQL
apt: pkg={{ item }} update_cache=yes state=present
sudo: yes
tags: postgres
with_items:
- postgresql-{{ postgresql_version }}
- postgresql-client-{{ postgresql_version }}
- postgresql-contrib-{{ postgresql_version }}
- libpq-dev
@maninhat
maninhat / VideoStream.php
Created June 8, 2023 06:38 — forked from ranacseruet/VideoStream.php
PHP VideoStream class for HTML5 video streaming
<?php
/**
* Description of VideoStream
*
* @author Rana
* @link http://codesamplez.com/programming/php-html5-video-streaming-tutorial
*/
class VideoStream
{
private $path = "";
@maninhat
maninhat / tokens.md
Created November 21, 2022 18:40 — forked from zmts/tokens.md
Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Last major update: 25.08.2020

  • Что такое авторизация/аутентификация
  • Где хранить токены
  • Как ставить куки ?
  • Процесс логина
  • Процесс рефреш токенов
  • Кража токенов/Механизм контроля токенов
<?php
/**
* CIDR.php
*
* Utility Functions for IPv4 ip addresses.
* Supports PHP 5.3+ (32 & 64 bit)
* @author Jonavon Wilcox <[email protected]>
* @revision Carlos Guimarães <[email protected]>
* @version Wed Mar 12 13:00:00 EDT 2014
*/
@maninhat
maninhat / ffprobe.sh
Created March 3, 2020 12:56 — forked from nrk/command.txt
Using ffprobe to get info from a file in a nice JSON format
ffprobe -v quiet -print_format json -show_format -show_streams "lolwut.mp4" > "lolwut.mp4.json"
<?php
namespace AppBundle\Doctrine;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Driver\PDOPgSql\Driver as PDOPgSqlDriver;
use Doctrine\ORM\NativeQuery;
class PgSqlNativeQueryCursor
{
@maninhat
maninhat / FieldsetType.php
Created February 22, 2019 11:50
Symfony Fieldset form type
<?php
use Symfony\Component\Form\AbstractType;
use Symfony\Component\OptionsResolver\OptionsResolver;
class FieldsetType extends AbstractType
{
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefault('inherit_data', true);
@maninhat
maninhat / create_user.sql
Created January 28, 2019 12:09
Create user in mysql
CREATE USER 'buhview'@'%' IDENTIFIED BY '123456';
GRANT USAGE ON *.* TO 'buhview'@'%';
GRANT SELECT ON TABLE migrants.view_acts TO 'buhview'@'%';
FLUSH PRIVILEGES;
docker run --rm -v /root/stat2018-12-03:/web-logs:ro -v awstats-db:/var/lib/awstats \
-e LOG_FORMAT="%host %other %logname %time1 %methodurl %code %bytesd" \
openmicroscopy/awstats /web-logs/access.log
78.40.217.219 - - [14/Mar/2016:15:10:14 +0300] "POST /index.php?t=1457957411 HTTP/1.1" 200 6894
https://github.com/openmicroscopy/awstats-docker
http://www.internetofficer.com/awstats/log-format/