Skip to content

Instantly share code, notes, and snippets.

View Gomah's full-sized avatar
⚗️

Thomas Marrec Gomah

⚗️
View GitHub Profile
@Gomah
Gomah / safetest.php
Created September 29, 2013 23:54
Server safetest
<?php
// Config
$forbiden_functions = array('escapeshellarg', 'escapeshellcmd', 'exec', 'link', 'passthru', 'pcntl_exec', 'popen', 'proc_close', 'proc_get_status', 'proc_nice', 'proc_open', 'proc_terminate', 'symlink', 'shell_exec','system');
$must_functions = array( 'base64_decode', 'fpassthru', 'ini_set', 'php_uname');
// Start
$disabled_functions = array_map("trim", explode(",",@ini_get("disable_functions")));
$issues = array();
@Gomah
Gomah / gist:6865646
Created October 7, 2013 10:22
proxyblocker
<?php
/*
---------------------------
Proxy Block Script by Gomah
---------------------------
*/
function check_proxy()
{
@Gomah
Gomah / gist:7364945
Created November 8, 2013 01:43
Static webserver @node.js
// Variables dc (http://nodejs.org/api/)
var http = require("http"),
url = require("url"),
path = require("path"),
fs = require("fs"),
port = process.argv[2] || 1337, // Array ex -> http://nodejs.org/docs/latest/api/process.html#process_process_argv
mimeTypes = {
// Basic mimes
'asc' : 'text/plain',
@Gomah
Gomah / urple-scheme-gnome-terminal.sh
Last active January 8, 2016 08:08
Urple scheme for Gnome Terminal
gconftool-2 --set /apps/gnome-terminal/profiles/Default/foreground_color --type string "#86799A"
gconftool-2 --set /apps/gnome-terminal/profiles/Default/background_color --type string "#1B1B23"
gconftool-2 --set /apps/gnome-terminal/profiles/Default/bold_color --type string "#A062EA"
gconftool-2 --set /apps/gnome-terminal/profiles/Default/palette --type string "#000000:#AF425B:#37A315:#AC5B41:#554D9A:#6C3BA1:#808080:#87799C:#5C3125:#FF6387:#28E51F:#F08061:#8579ED:#A05DEE:#EAEAEA:#BFA3FF"
@Gomah
Gomah / ISO-3166-1.js
Created February 10, 2017 05:31
List of all ISO 3166-1 countries
/**
* List of all ISO 3166-1 countries
* NOTE: https://www.iso.org/obp/ui/#search
*/
export default [
{
name: 'Afghanistan',
code: 'AF',
},
@Gomah
Gomah / destructuring.js
Created March 1, 2017 02:33
Dynamic Destructuring assignment
const props = {
address: {
show: false,
},
};
const field = {
touch: 'address',
};
[user]
email = hi@gomah.fr
name = Gomah
[alias]
loggy = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'
prune = fetch --prune
stash-all = stash save --include-untracked
undo = reset --soft HEAD^
@Gomah
Gomah / my.cnf
Created April 28, 2017 04:09
MySQL config for 4 cores/8 threads, 32 GB RAM
# CLIENT
[client]
port = 3306
socket = /var/run/mysqld/mysqld.sock
# MYSQL SAFE
[mysqld_safe]
pid-file = /var/run/mysqld/mysqld.pid
@Gomah
Gomah / smaller.js
Last active May 23, 2017 04:33 — forked from nqthqn/smaller.js
Obtain better load time!
import tinify from 'tinify';
import walk from 'walk';
import path from 'path';
tinify.key = '';
const dir = path.join(__dirname, '../src/assets');
const files = [];
const walker = walk.walk(dir, { followLinks: false });
@Gomah
Gomah / lambda-edge-prerender.js
Created July 25, 2017 23:46
Return pre-rendered html files for non-supported browsers
const whitelist = ['chrome', 'crios', 'firefox', 'fxios', 'googlebot'];
const isSupportedBrowser = uas => {
if (uas && Array.isArray(uas) && uas.length > 0) {
return uas.some(ua =>
whitelist.some(w => ua.value.toLowerCase().includes(w))
);
}
return false;
};