Skip to content

Instantly share code, notes, and snippets.

Avatar

Patrick Drechsler draptik

View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am draptik on github.
  • I am draptik (https://keybase.io/draptik) on keybase.
  • I have a public key whose fingerprint is 10A4 B0E4 277F CD15 9F08 845D B063 1437 5124 4030

To claim this, I am signing this object:

@draptik
draptik / chocolatey-sample-dev-tools.txt
Created Sep 25, 2014
Chocolatey packages for developers001 (browsers, git, keepass, truecrypt)
View chocolatey-sample-dev-tools.txt
C:\>choco install GoogleChrome Firefox fiddler git TortoiseGit Emacs 7zip keepass truecrypt
View nginxproxy.md

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

@draptik
draptik / gist:614fe988c929525b25d5
Created May 22, 2015
Git alias settings in gitconfig
View gist:614fe988c929525b25d5
alias.ec=config --global -e
alias.up=pull --rebase
alias.co=checkout
alias.cob=checkout -b
alias.ls=log --pretty=format:'%C(yellow)%h%Creset%C(bold red)%d %Creset%s%Cgreen [%cn] %C(bold green)(%cr)%Creset' --decorate
alias.ll=log --graph --pretty=format:'%Cred%h%Creset -%C(bold yellow)%d%Creset %s %Cgreen(%cr) %C(dim green)<%an>%Creset' --abbrev-commit --
date=relative
alias.f=!git ls-files | grep -i
alias.grep=grep -Ii
alias.m=merge
@draptik
draptik / ps1_git.sh
Created Aug 11, 2012
PS1 prompt with git branch
View ps1_git.sh
# Idea from:
#
# https://bbs.archlinux.org/viewtopic.php?pid=1068202
# Colors https://wiki.archlinux.org/index.php/Color_Bash_Prompt
# Note: We require escape '\[' and '\]' around the ansi escapes
# (i.e. '\e[0m')! Otherwise the shell does not know that the ansi
# escapes should be excluded from the line wrapping calculation.
#
# See
@draptik
draptik / backup_large_files
Created Oct 9, 2012
Backup script using rdiff-backup, duplicity and rsync
View backup_large_files
#!/bin/bash
#
# Setup:
#
# +--------+ +-----+
# | MyData | | HDD |
# | | (1) rdiff-backup | |
# | | ------------------> | |
# | | | | +-----+
# | | (2) duplicity | | (3) rsync | USB |
@draptik
draptik / javascript-nested-groupby-with-aggregation
Last active Jun 25, 2016
multi-level nesting (aka groupby) in javascript using d3.js (adapted from http://learnjsdata.com/group_data.html)
View javascript-nested-groupby-with-aggregation
var expect = require('chai').expect;
var d3 = require('d3');
describe('app', function () {
var myData = [
{ countryCode: 'DE', areaName: 'DE1', speciesName: 's1', totalScore: 1000 },
{ countryCode: 'DE', areaName: 'DE1', speciesName: 's2', totalScore: 2000 },
{ countryCode: 'DE', areaName: 'DE1', speciesName: 's3', totalScore: 3000 },
{ countryCode: 'DE', areaName: 'DE2', speciesName: 's1', totalScore: 1000 },
@draptik
draptik / JS-LINQ.js
Created Jul 18, 2016 — forked from DanDiplo/JS-LINQ.js
JavaScript equivalents of some common C# LINQ methods. To help me remember!
View JS-LINQ.js
// JS array equivalents to C# LINQ methods - by Dan B.
// Here's a simple array of "person" objects
var people = [
{ name: "John", age: 20 },
{ name: "Mary", age: 35 },
{ name: "Arthur", age: 78 },
{ name: "Mike", age: 27 },
{ name: "Judy", age: 42 },
{ name: "Tim", age: 8 }
View python-virtualenvwrapper_setup.sh
# pacman -S python-virtualenvwrapper
$ echo 'WORKON_HOME=$HOME/.virtualenvs' >> ~/.bashrc
$ . ~/.bashrc
$ mkdir -p $WORKON_HOME
$ echo 'source /usr/bin/virtualenvwrapper.sh' > ~/.bashrc
$ . ~/.bashrc
$ mkvirtualenv -p python2.7 --distribute blog_env
@draptik
draptik / CustomerController.cs
Created Nov 8, 2016 — forked from vkhorikov/CustomerController.cs
Handling failures and input errors in a functional way
View CustomerController.cs
[HttpPost]
public HttpResponseMessage CreateCustomer(string name, string billingInfo)
{
Result<BillingInfo> billingInfoResult = BillingInfo.Create(billingInfo);
Result<CustomerName> customerNameResult = CustomerName.Create(name);
return Result.Combine(billingInfoResult, customerNameResult)
.OnSuccess(() => _paymentGateway.ChargeCommission(billingInfoResult.Value))
.OnSuccess(() => new Customer(customerNameResult.Value))
.OnSuccess(