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 / 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 / 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 });
export class GraphModel {
/**
* @param {Object} attrs Attributes on the GraphModel.
*/
constructor(attrs) {
Object.defineProperty(this, 'attrs', { value: attrs, enumerable: false });
Object.keys(this.attrs).filter(key => !(key in this)).forEach(key => {
let descriptor;
if (attrs[key] === null) {
descriptor = {
@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;
};
@Gomah
Gomah / uploaded.net.js
Created August 27, 2017 00:59
Login support for uploaded.net
import axios from 'axios';
import axiosCookieJarSupport from '@3846masa/axios-cookiejar-support';
import tough from 'tough-cookie';
import FormData from 'form-data';
// Add cookie support for axios
axiosCookieJarSupport(axios);
class Uploaded {
constructor(options) {