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 / 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 / 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 / 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 / docker.txt
Created August 31, 2015 18:06
just some docker commands
docker run hello-world
docker-machine upgrade dev
@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 / app.js
Last active August 29, 2015 14:11 — forked from jeff-hager-dev/app.js
var express = require('express');
var fs = require('fs');
var path = require('path');
var port = 3005;
var staticDir = "staticFiles"
var app = express();
app.use(function (req, res, next) {
//NOTE (JNHager): NEVER DO THIS IN A PRODUCTION SYSTEM. STRICTLY FOR TESTING LOCALLY!!!!
@h3xxx
h3xxx / httpd.conf
Created December 19, 2014 15:10
Apache2 subdomains (different ports) redirection
### from http://serverfault.com/questions/195611/how-do-i-redirect-subdomains-to-a-different-port-on-the-same-server
NameVirtualHost *:80
<VirtualHost *>
ServerAdmin [email protected]
ServerName dev.mydomain.com
ProxyPreserveHost On
# setup the proxy
def makeRandStr(length = 7, chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJLKMNOPQRSTUVWXYZ0123456789')
str = ''
for num in 1..length
str += chars[rand(0..(chars.length - 1))]
end
return str
end
@h3xxx
h3xxx / android-apps.txt
Last active August 29, 2015 14:11
Android apps
Just my favourite apps:
Allegro
Apollo
Amazon Appstore
Avast Mobile Security
Aviary
CCleaner
Ceneo
Chrome
@h3xxx
h3xxx / validate_ip.cs
Created December 6, 2014 14:16
validate IP address - test case progam
// Decompiled with JetBrains decompiler
// Type: val_ip.Program
// Assembly: val_ip, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: 5E7D5EDC-F012-4AF3-A5E5-6610706D35E8
using System;
using System.IO;
using System.Runtime.InteropServices;
namespace val_ip