Skip to content

Instantly share code, notes, and snippets.

View zoerab's full-sized avatar
⚙️
Worshipping the Machine God

0xZRB zoerab

⚙️
Worshipping the Machine God
  • Belgium
View GitHub Profile
@zoerab
zoerab / boilerplate.js
Last active January 25, 2016 13:48
JavaScript boilerplate
(function(){
'use strict';
}());
@zoerab
zoerab / fail2ban-allstatus.sh
Created January 5, 2016 12:13 — forked from kamermans/fail2ban-allstatus.sh
Show status of all fail2ban jails at once
#!/bin/bash
JAILS=`fail2ban-client status | grep "Jail list" | sed -E 's/^[^:]+:[ \t]+//' | sed 's/,//g'`
for JAIL in $JAILS
do
fail2ban-client status $JAIL
done
@zoerab
zoerab / .gitignore
Last active August 19, 2024 14:54
.gitignore boilerplate
# Packages #
############
# it's better to unpack these files and commit the raw source
# git has its own built in compression methods
*.7z
*.dmg
*.gz
*.iso
*.jar
*.rar
@zoerab
zoerab / default_parameters.js
Last active January 25, 2016 13:47
JavaScript function default parameter values in ES5 and bellow
function foo(a, b) {
a = typeof a !== 'undefined' ? a : 'default_a';
b = typeof b !== 'undefined' ? b : 'default_b';
}
@zoerab
zoerab / skeleton.php
Last active January 25, 2016 13:45
PHP basic skeleton structure
<?php
/****************************************************
* Initialisation
****************************************************/
$_srv = $_SERVER['PHP_SELF'];
try
{
@zoerab
zoerab / random.js
Created January 25, 2016 13:43
JavaScript - random number in a specific range
/**
* Get a random floating point number between `min` and `max`.
*
* @param {number} min - min number
* @param {number} max - max number
* @return {float} a random floating point number
*/
function getRandom(min, max) {
return Math.random() * (max - min) + min;
@zoerab
zoerab / deadcenter.css
Created January 25, 2016 18:40
Dead center css class
.absolute-center {
margin: auto;
position: absolute;
top: 0; left: 0; bottom: 0; right: 0;
}
sudo npm install npm -g
function var2console($var, $name='', $now=false)
{
if ($var === null) $type = 'NULL';
else if (is_bool ($var)) $type = 'BOOL';
else if (is_string ($var)) $type = 'STRING['.strlen($var).']';
else if (is_int ($var)) $type = 'INT';
else if (is_float ($var)) $type = 'FLOAT';
else if (is_array ($var)) $type = 'ARRAY['.count($var).']';
else if (is_object ($var)) $type = 'OBJECT';
else if (is_resource($var)) $type = 'RESOURCE';