Skip to content

Instantly share code, notes, and snippets.

View jpillora's full-sized avatar
👶

Jaime Pillora jpillora

👶
View GitHub Profile
@jpillora
jpillora / csrand.go
Last active April 12, 2016 23:46
Hash DRBG implementation in Go (Golang) from the TOR project
/*
* Copyright (c) 2014, Yawning Angel <yawning at torproject dot org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
@jpillora
jpillora / determ_crypto_reader.go
Last active August 29, 2015 14:25
Deterministic crypto/rand Reader
// WARNING: This is a bad idea.
// Instead, use a Deterministic random bit generator specified in NIST SP 800-90A
// Unverified Go implementation from the TOR project:
// https://gist.github.com/jpillora/ed5cf69af7d35f9bb5f1
@jpillora
jpillora / README.md
Last active August 3, 2018 21:44
Timeshot - Timesheet Screenshots

Timeshot

You can just run Timeshot in two ways:

  1. Execute timeshot.sh directly and leave your terminal window open in the foreground
  2. Load the timeshot.plist file to ensure it always runs in the background
  3. Change the WorkingDirectory to where your timeshot.sh is
  4. Copy timeshot.plist to ~/Library/LaunchAgents/timeshot.plist
  5. Execute launchctl load -w timeshot.plist
  6. Confirm its running with launchctl list | grep timeshot
@jpillora
jpillora / openswan-l2tp-vpn-ubuntu.sh
Created July 21, 2015 13:14
openswan-l2tp-vpn-ubuntu.sh
#!/bin/sh
# Setup Simple IPSec/L2TP VPN server for Ubuntu and Debian
#
# Copyright (C) 2014 Phil Plückthun <phil@plckthn.me>
# Based on the work of Lin Song (Copyright 2014)
# Based on the work of Viljo Viitanen (Setup Simple PPTP VPN server for Ubuntu and Debian)
# Based on the work of Thomas Sarlandie (Copyright 2012)
#
# This work is licensed under the Creative Commons Attribution-ShareAlike 3.0
# Unported License: http://creativecommons.org/licenses/by-sa/3.0/
@jpillora
jpillora / parse-comparator.js
Created June 13, 2015 11:12
parse collection comparator
//comparator string doesn't work, so you need to provide a sort function,
// read more http://mdn.io/sort
var Foo = Parse.Object.extend("Foo");
var Foos = Parse.Collection.extend("Foos", {
model: Foo
});
var foos = new Foos();
@jpillora
jpillora / gitlab-docker.sh
Last active August 29, 2015 14:22
Gitlab Docker setup
#gitlab requires postgres and redis
#all 3 containers store their data in /opt
#the only variables that really need to be set
#are: GITLAB_HOST and GITLAB_ROOT_PASSWORD
mkdir -p /opt/postgresql/data
docker run --name 'postgresql-gitlab' \
-d \
-e 'DB_USER=gitlab_user' \
-e 'DB_PASS=gitlab_pass' \
@jpillora
jpillora / simple-templating.go
Created May 16, 2015 06:10
Simple Templating in Go
package main
import (
"fmt"
"regexp"
)
func main() {
str := "my string and {{ foo }} and {{bar}}!"
str = template(str, map[string]string{"foo": "1", "bar": "2"})
#env
set -x GOPATH $HOME/go
set -x PATH $GOPATH/bin /usr/local/go/bin $PATH
#fish
set fish_greeting ""
function fish_prompt
set_color $fish_color_cwd
echo -n yournamehere
@jpillora
jpillora / go-get-gitlab-ssh-nginx
Created May 10, 2015 08:38
Go get Gitlab ssh paths with nginx
location / {
## check for goget AND /namespace/project
if ($args ~* "^go-get=1") {
set $condition goget;
}
if ($uri ~ ^/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)$) {
set $condition "${condition}path";
}
if ($condition = gogetpath) {
return 200 "<!DOCTYPE html><html><head><meta content='git.axon$uri git ssh://git@gitlab.mycompany.com:2200$uri.git' name='go-import'></head></html>";
@jpillora
jpillora / utserver.conf
Last active February 21, 2019 11:55
Sample utorrent server "utserver" config file http://forum.utorrent.com/topic/73370-sample-utserverconfig-file/
##
## utserver.conf
## Configuration settings template for μTorrent for Linux.
## Taken from μTorrent Server manual for version alpha-3.3.
## ©2013 BitTorrent, Inc.
## Compiled by Rich.T.
##
##
## Command-line Arguments