Skip to content

Instantly share code, notes, and snippets.

View lotfio's full-sized avatar
💭
I may be slow to respond.

lotfio lakehal lotfio

💭
I may be slow to respond.
View GitHub Profile
@lotfio
lotfio / Windows batch file to start Nginx Php-fpm and Mysql in one console
Last active December 13, 2017 16:24
Windows batch file to start Nginx Php-fpm and Mysql in one console
@ECHO OFF
::mysql
pushd C:\WebServer\mariadb\bin
START /b mysqld.exe
ECHO Starting mysql ......
:: apache2
pushd C:\WebServer\apache\bin
START /b httpd.exe
@lotfio
lotfio / Teamspeak 3 server on debian 9 with auto restart and fail2ban
Last active March 31, 2020 19:21
Teamspeak 3 server on debian 9 with auto restart and fail2ban
# create a ts3 user
adduser --disabled-login ts3
# Get the latest TeamSpeak 3 server files for 64-bit Linux.
wget http://dl.4players.de/ts/releases/3.1.1/teamspeak3-server_linux_amd64-3.2.3.tar.bz2
# Extract the archive.
cd /opt
@lotfio
lotfio / php_socket_server
Last active September 22, 2019 14:26
Create a usless PHP socket Server
#!/usr/bin/env php
<?php
$sock = socket_create(AF_INET, SOCK_STREAM, 0);
$bind = socket_bind($sock, "127.0.0.1", "9000");
$listen = socket_listen($sock);
echo "\n starting server 127.0.0.1:9000\n\n";
@lotfio
lotfio / event.php
Created October 13, 2019 10:54
PHP event example
<?php
class Event
{
public function fire($event, $params = NULL)
{
return call_user_func($this->{"on".ucfirst($event)});
}
}
@lotfio
lotfio / temporary-email-address-domains
Created October 21, 2019 13:44 — forked from adamloving/temporary-email-address-domains
A list of domains for disposable and temporary email addresses. Useful for filtering your email list to increase open rates (sending email to these domains likely will not be opened).
0-mail.com
0815.ru
0clickemail.com
0wnd.net
0wnd.org
10minutemail.com
20minutemail.com
2prong.com
30minutemail.com
3d-painting.com
@lotfio
lotfio / Router.php
Created October 24, 2019 07:07
PHP stupid 5 minutes router
class Router
{
private $methods = array(
"GET", "POST", "PUT",
"PURGE", "DELETE"
);
private $routes;
public function __call($name, $arguments)
@lotfio
lotfio / migration.php
Last active December 11, 2019 10:09 — forked from jmny/migration.php
phinx outside cli
$phinxApp = new \Phinx\Console\PhinxApplication();
$phinxTextWrapper = new \Phinx\Wrapper\TextWrapper($phinxApp);
$phinxTextWrapper->setOption('configuration', 'phinx.yml');
$phinxTextWrapper->setOption('parser', 'YAML');
$phinxTextWrapper->setOption('environment', 'development');
@lotfio
lotfio / sqlite3.cpp
Created April 30, 2020 21:36
c++ sqlite3 create table and insert example
#include <iostream>
// dowload sqlite-amalgamation
// include header and link with sqlite3.o after creating object file from sqlite3.c
#include "../sqlite3/sqlite3.h"
static int callback(void *NotUsed, int argc, char **argv, char **azColName) {
return 0;
}
class Sqlite
@lotfio
lotfio / decryptchromecookies.py
Created August 25, 2021 09:58
Decrypt Chrome Cookies File (Python 3) - Windows
# Based on:
# https://gist.github.com/DakuTree/98c8362fb424351b803e
# https://gist.github.com/jordan-wright/5770442
# https://gist.github.com/DakuTree/428e5b737306937628f2944fbfdc4ffc
# https://stackoverflow.com/questions/60416350/chrome-80-how-to-decode-cookies
# https://stackoverflow.com/questions/43987779/python-module-crypto-cipher-aes-has-no-attribute-mode-ccm-even-though-pycry
import os
import json
import base64