Skip to content

Instantly share code, notes, and snippets.

View h3xxx's full-sized avatar
:octocat:
hello :trollface: 💻 :hurtrealbad:

Roger Bonin h3xxx

:octocat:
hello :trollface: 💻 :hurtrealbad:
View GitHub Profile
@h3xxx
h3xxx / server-tuning.txt
Last active August 29, 2015 14:13
server tuning notes
# nmap
PORT STATE SERVICE VERSION
21/tcp open ftp
22/tcp open ssh
# iostat
Linux 3.13.0-43-generic 01/10/15 _x86_64_ (4 CPU)
avg-cpu: %user %nice %system %iowait %steal %idle
0.58 0.00 0.24 5.31 0.00 93.87
@h3xxx
h3xxx / docker.txt
Created August 31, 2015 18:06
just some docker commands
docker run hello-world
docker-machine upgrade dev
@h3xxx
h3xxx / json_to_java_map.java
Created October 21, 2015 19:19
Converting JSON To Map With Java 8 Without Dependencies. Starting with JDK 8u60+ the built-in Nashorn engine is capable to convert Json content into java.util.Map. No external dependencies are required for parsing, Origin: http://adam-bien.com/roller/abien/entry/converting_json_to_map_with
// Converting JSON To Map With Java 8 Without Dependencies.
// Starting with JDK 8u60+ the built-in Nashorn engine is capable to convert Json content into java.util.Map.
// No external dependencies are required for parsing,
// Origin: http://adam-bien.com/roller/abien/entry/converting_json_to_map_with
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Map;
import javax.script.ScriptEngine;
@h3xxx
h3xxx / my-regexps.md
Last active December 22, 2015 12:55
My RegExps [builder: http://regexr.com/]

RegExp for searching multiple method execution in one line of code.

RegExp:

/(.([a-zA-Z]+\(["'][a-zA-Z-]+["']\))){2,}/g

Test values:

  Obj.prop.methodX("val").methodY("val");
 this.get("someClass").addClass("full");
@h3xxx
h3xxx / private_public.js
Last active January 13, 2016 10:34
Private and public functions in JS.
// taken from http://stackoverflow.com/questions/55611/javascript-private-methods
function Restaurant() {
var myPrivateVar;
var private_stuff = function() { // Only visible inside Restaurant()
myPrivateVar = "I can set this here!";
}
this.use_restroom = function() { // use_restroom is visible to all
@h3xxx
h3xxx / opacit_visibility_display_diffs.txt
Created January 12, 2016 10:15
CSS opacit, visibility and display differences.
collapse events taborder
opacity: 0 No Yes Yes
visibility: hidden No No No
visibility: collapse * No No
display: none Yes No No
* Yes inside a table element, otherwise No.
taken from http://stackoverflow.com/questions/272360/does-opacity0-have-exactly-the-same-effect-as-visibilityhidden
@h3xxx
h3xxx / dev_console.js
Created January 13, 2016 10:33
Snippet for clear JS console.
// taken from http://stackoverflow.com/questions/3011600/clear-javascript-console-in-google-chrome
if (typeof console._commandLineAPI !== 'undefined') {
console.API = console._commandLineAPI;
} else if (typeof console._inspectorCommandLineAPI !== 'undefined') {
console.API = console._inspectorCommandLineAPI;
} else if (typeof console.clear !== 'undefined') {
console.API = console;
}
@h3xxx
h3xxx / index.html
Created March 3, 2016 08:02
A Basic HTML5 Template For Any Project
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>HTML5 Template</title>
<meta name="description" content="HTML5">
<meta name="author" content="Author">
@h3xxx
h3xxx / server-status.py
Created March 15, 2016 15:47
CGI script in Python for executing predefined commands
#!/usr/bin/python
import cgi, cgitb, os, sys
import commands
cgitb.enable(); # formats errors in HTML
form = cgi.FieldStorage()
sys.stderr = sys.stdout
print "Content-type: text/html"
print
var Timeout = {
_timeouts: {},
set: function(name, func, time){
this.clear(name);
this._timeouts[name] = {pending: true, func: func};
var tobj = this._timeouts[name];
tobj.timeout = setTimeout(function()
{
/* setTimeout normally passes an accuracy report on some browsers, this just forwards that. */
tobj.func.call(arguments);