Skip to content

Instantly share code, notes, and snippets.

View jgermade's full-sized avatar
🎨
Working from home

Jesús Germade jgermade

🎨
Working from home
View GitHub Profile
@jgermade
jgermade / .bashrc
Created October 9, 2014 15:15
.bashrc
# at the end
unset color_prompt force_color_prompt
export PS1='\[\033[01;33m\] \w\[\033[32m\] $(__git_ps1 "(%s)") \[\033[01;34m\]$\[\033[00m\] '
bind '"\e[A": history-search-backward'
bind '"\e[B": history-search-forward'
source "$HOME/bin/custom-script.sh"
@jgermade
jgermade / log.js
Created October 16, 2014 11:06
log.js
(function() {
var log;
log = function(enable) {
if (log.enabled) {
log.history.push(arguments);
if (window.console) {
window.console.log.apply(window.console, Array.prototype.slice.call(arguments));
}
} else if (enable === !void 0) {
log.enabled = enable;
@jgermade
jgermade / Emitter(foobar).js
Last active August 29, 2015 14:08
Emitter static and dynamic
function Emitter (name) {
var emitter = this;
this.$name = name;
this.staticTriggeredBy = [];
this.staticTrigger = function () {
emitter.staticTriggeredBy.push({ $name: this.$name, name: this.name });
console.log('[static] $name: ' + this.$name + ', name: ' + this.name);
console.log(JSON.stringify(emitter.staticTriggeredBy));
};
function _Emitter (name) {
this.callers = {};
}
_Emitter.prototype.add = function () {
this.callers[this.name] = true;
};
_Emitter.prototype.log = function () {
console.log(JSON.stringify(this.callers));
@jgermade
jgermade / .htaccess
Last active August 29, 2015 14:16 — forked from revolunet/.htaccess
# with AJAX withCredentials=false (cookies NOT sent)
Header always set Access-Control-Allow-Origin "*"
Header always set Access-Control-Allow-Methods "POST, GET, PUT, OPTIONS, PATCH, DELETE"
Header always set Access-Control-Allow-Headers "X-Accept-Charset,X-Accept,Content-Type"
RewriteEngine On
RewriteCond %{REQUEST_METHOD} OPTIONS
RewriteRule ^(.*)$ $1 [R=200,L,E=HTTP_ORIGIN:%{HTTP:ORIGIN}]]
# with AJAX withCredentials=true (cookies sent, SSL allowed...)
SetEnvIfNoCase ORIGIN (.*) ORIGIN=$1
#!/bin/bash
# slanger daemon
# chkconfig: 345 20 80
# description: slanger daemon
# processname: slanger
. /etc/rc.d/init.d/functions
# Location of a non-daemon application to be daemonized
BIN="/home/xxx/.rvm/gems/ruby-1.9.2-p290/bin/slanger --app_key XXXX --secret YYYY --api_host 0.0.0.0:4568 --websocket_host 0.0.0.0:8081"
@jgermade
jgermade / .gitconfig
Last active August 29, 2015 14:17 — forked from pksunkara/config
[user]
name = Pavan Kumar Sunkara
email = [email protected]
[core]
editor = vim
whitespace = fix,-indent-with-non-tab,trailing-space,cr-at-eol
excludesfile = ~/.gitignore
[sendemail]
smtpencryption = tls
smtpserver = smtp.gmail.com
@jgermade
jgermade / crypt flow
Last active August 29, 2015 14:21
CryptZ
sha3-512
answer: sha( question + sha(pass) )
aes-psk: sha( sha(pass) + question )
Authentication: Bearer {ACCESS_TOKEN}
X-Request: uuid.v4
X-Signature: aes(request.uuid, aes-psk)
Payload: aes(payload, aes-psk)
@jgermade
jgermade / _service.md
Last active August 29, 2015 14:25 — forked from naholyr/_service.md

Sample service script for debianoids

Look at LSB init scripts for more information.

Usage

Copy to /etc/init.d:

# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)
@jgermade
jgermade / install-pre-commit.sh
Last active August 27, 2015 09:12 — forked from stefansundin/install-pre-commit.sh
Git pre-commit check to stop accidental commits to master and develop branches. There is also a variant with a core.whitespace check.
#!/bin/sh
# This script will install a Git pre-commit hook that stop accidental commits to master and develop branches.
# There is also a variant that includes a core.whitespace check. See pre-commit-2 below.
# Install in current Git repo:
# curl -fL https://gist.githubusercontent.com/stefansundin/9059706/raw/install-pre-commit.sh | sh
# Install with core.whitespace check:
# curl -fL https://gist.githubusercontent.com/stefansundin/9059706/raw/install-pre-commit.sh | sh -s pre-commit-2
# Install with core.whitespace check and EOF-newline-check:
# curl -fL https://gist.githubusercontent.com/stefansundin/9059706/raw/install-pre-commit.sh | sh -s pre-commit-3
# Install only core.whitespace check: