Skip to content

Instantly share code, notes, and snippets.

View nikvdp's full-sized avatar

Nik nikvdp

View GitHub Profile
@nikvdp
nikvdp / DefaultKeyBinding.dict
Created June 20, 2013 09:07
Config file to sets up full emacs bindings throughout OS X (including ctrl keys)
/* (mostly) Full Emacs style key bindings for any OS X (Cocoa) app
*
* to use save this file to ~/Library/KeyBindings/DefaultKeyBinding.dict
* (will need to create the ~/Library/KeyBindings/ folder first)
*
* If you want to set up your own bindings take a look at Apple's documentation
* for NSResponder:
* https://developer.apple.com/library/mac/#documentation/cocoa/reference/ApplicationKit/Classes/NSResponder_Class/Reference/Reference.html
*
* Originally from:
#!/usr/bin/env bash
##################################################################################
# ubuntu_auto_netselector.sh #
# #
# This script will automatically get list of ubuntu mirrors, choose the fastest #
# one and optionally modify your /etc/apt/sources.list to use it. #
# #
##################################################################################
@nikvdp
nikvdp / merge-ovpn-keys.sh
Last active January 4, 2021 08:13
Merges separated ovpn scripts into one
#!/bin/bash
#######################################################################
# Taken from: https://www.dropbox.com/s/v228zvccef9d10c/merge.sh
# Latest versions of Openvpn supports inline certs and keys
# so you have one client script, instead of script plus 4 keys and certs
#
# This tool assumes
# 1) Openvpn script and certs plus keys are in same directory
# 2) Certs are usually specified in Openvpn script like
# ca ca.crt

Ctags with Sublime Text and Coffeescript

Get Ctags

Step one is to install Exuberant Ctags on your system. For those on an Ubuntu system, this is as simple as:

sudo apt-get install ctags

Get the Sublime Text Plug-in

@nikvdp
nikvdp / splitArray.js
Created January 20, 2016 20:03
Split's an array into array's of n length
/**
*
* Split the array into arrays of n each,
* e.g. if n is 2 [1,2,3,4,5,6] becomes [[1,2], [3,4], [5,6]
*
* @param inputArr - Array
* @param n - Number
*/
function splitBy(inputArr, n) {
var result = [];
@nikvdp
nikvdp / left.json
Created February 12, 2016 07:55 — forked from benjamine/left.json
Json Diff Example
{
"name": "South America",
"summary": "South America (Spanish: América del Sur, Sudamérica or Suramérica; Portuguese: América do Sul; Quechua and Aymara: Urin Awya Yala; Guarani: Ñembyamérika; Dutch: Zuid-Amerika; French: Amérique du Sud) is a continent situated in the Western Hemisphere, mostly in the Southern Hemisphere, with a relatively small portion in the Northern Hemisphere. The continent is also considered a subcontinent of the Americas.[2][3] It is bordered on the west by the Pacific Ocean and on the north and east by the Atlantic Ocean; North America and the Caribbean Sea lie to the northwest. It includes twelve countries: Argentina, Bolivia, Brazil, Chile, Colombia, Ecuador, Guyana, Paraguay, Peru, Suriname, Uruguay, and Venezuela. The South American nations that border the Caribbean Sea”including Colombia, Venezuela, Guyana, Suriname, as well as French Guiana, which is an overseas region of France”are also known as Caribbean South America. South America has an area of 17,840,000 square kilome
diff --git a/.SRCINFO b/.SRCINFO
index 8266f23..be95f93 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,16 +1,16 @@
-# Generated by mksrcinfo v8
-# Thu Dec 8 17:47:17 UTC 2016
pkgbase = gitfs
pkgdesc = Version controlled file system
pkgver = 0.4.5.1

Keybase proof

I hereby claim:

  • I am nikvdp on github.
  • I am nikvdp (https://keybase.io/nikvdp) on keybase.
  • I have a public key ASB1Eru_a1bq6bA62wsXhaKGVO6xWENrk3VlCiyqQVw4rQo

To claim this, I am signing this object:

@nikvdp
nikvdp / unwrap.py
Created October 30, 2020 06:08
A one liner to unwrap a list (or any iterable) with any amount of nesting
"""
A handy and cool recursive lambda (!) to safely get an item out of a deeply
nested list or iterable:
>>> unwrap = lambda x: unwrap(next(iter(x), None)) if '__iter__' in dir(x) and not isinstance(x, str) else x
>>> unwrap(2)
2
>>> unwrap(["hi"])
'hi'
>>> unwrap([[[[[[["ok ok, i get it"]]]]]]])
rest=()
while [[ $# -ge 1 ]]; do
arg="$1"
shift
case "$arg" in
-f|--foo)
foo=true
;;
-p|--param-that-takes-an-arg)