Skip to content

Instantly share code, notes, and snippets.

@jshbrntt
jshbrntt / private.xml
Created March 10, 2015 10:38
Karabiner ScrollWheel (Left/Right) to OSX Spaces Navigation
<?xml version="1.0"?>
<root>
<item>
<name>ScrollWheel(Left/Right)</name>
<appendix>(You can switch Desktop by scroll wheel left/right.)</appendix>
<identifier>private.scroll_wheel_left_right</identifier>
<autogen>
__ScrollWheelToKey__
ScrollWheel::LEFT | ModifierFlag::NONE,
KeyCode::CURSOR_LEFT, ModifierFlag::CONTROL_R
anonymous
anonymous / globalmaptiles.py
Created December 27, 2012 04:06
Create dots from US Census block-level shapefiles
#!/usr/bin/env python
###############################################################################
# $Id$
#
# Project: GDAL2Tiles, Google Summer of Code 2007 & 2008
# Global Map Tiles Classes
# Purpose: Convert a raster into TMS tiles, create KML SuperOverlay EPSG:4326,
# generate a simple HTML viewers based on Google Maps and OpenLayers
# Author: Klokan Petr Pridal, klokan at klokan dot cz
# Web: http://www.klokan.cz/projects/gdal2tiles/
@johanmeiring
johanmeiring / gist:2894568
Created June 8, 2012 08:52
PHP str_putcsv function
<?php
/* From: http://www.php.net/manual/en/function.str-getcsv.php#88773 and http://www.php.net/manual/en/function.str-getcsv.php#91170 */
if(!function_exists('str_putcsv'))
{
function str_putcsv($input, $delimiter = ',', $enclosure = '"')
{
// Open a memory "file" for read/write...
$fp = fopen('php://temp', 'r+');
// ... write the $input array to the "file" using fputcsv()...
fputcsv($fp, $input, $delimiter, $enclosure);
@nealfennimore
nealfennimore / wireguard.conf
Last active April 3, 2024 09:49
Wireguard VPN - Forward all traffic to server
# ------------------------------------------------
# Config files are located in /etc/wireguard/wg0
# ------------------------------------------------
# ---------- Server Config ----------
[Interface]
Address = 10.10.0.1/24 # IPV4 CIDR
Address = fd86:ea04:1111::1/64 # IPV6 CIDR
PostUp = iptables -A FORWARD -i wg0 -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE; ip6tables -A FORWARD -i wg0 -j ACCEPT; ip6tables -t nat -A POSTROUTING -o eth0 -j MASQUERADE # Add forwarding when VPN is started
PostDown = iptables -D FORWARD -i wg0 -j ACCEPT; iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE; ip6tables -D FORWARD -i wg0 -j ACCEPT; ip6tables -t nat -D POSTROUTING -o eth0 -j MASQUERADE # Remove forwarding when VPN is shutdown
@joechrysler
joechrysler / who_is_my_mummy.sh
Last active April 8, 2024 13:36
Find the nearest parent branch of the current git branch
#!/usr/bin/env zsh
git show-branch -a \
| grep '\*' \
| grep -v `git rev-parse --abbrev-ref HEAD` \
| head -n1 \
| sed 's/.*\[\(.*\)\].*/\1/' \
| sed 's/[\^~].*//'
# How it works:
@zhujunsan
zhujunsan / Using Github Deploy Key.md
Last active April 14, 2024 02:35
Using Github Deploy Key

What / Why

Deploy key is a SSH key set in your repo to grant client read-only (as well as r/w, if you want) access to your repo.

As the name says, its primary function is to be used in the deploy process in replace of username/password, where only read access is needed. Therefore keep the repo safe from the attack, in case the server side is fallen.

How to

  1. Generate a ssh key