View extract-attachments.py
#!/usr/bin/env python3
# Get your files that Gmail block. Warning message:
# "Anti-virus warning - 1 attachment contains a virus or blocked file. Downloading this attachment is disabled."
# Based on: https://spapas.github.io/2014/10/23/retrieve-gmail-blocked-attachments/
# Instructions:
# Go to your emails, click the arrow button in the top right, "Show original", then "Download Original".
# Move the files to the same directory as this program, then run it.
import email
View install-pre-commit.sh
#!/bin/sh
# This gist contains pre-commit hooks to prevent you from commiting bad code or to the wrong branch.
# There are four variants that I have built:
# - pre-commit: stops commits to "master" and "develop" branches.
# - pre-commit-2: also includes a core.whitespace check.
# - pre-commit-3: the core.whitespace check and an EOF-newline-check.
# - pre-commit-4: only the core.whitespace check.
# Set desired version like this before installing:
# FILE=pre-commit
View openssh-7.3.sh
$ ssh -V
OpenSSH_7.2p2 Ubuntu-4ubuntu2.1, OpenSSL 1.0.2g 1 Mar 2016
$ wget https://launchpadlibrarian.net/277739251/openssh-client_7.3p1-1_amd64.deb
$ wget https://launchpadlibrarian.net/298453050/libgssapi-krb5-2_1.14.3+dfsg-2ubuntu1_amd64.deb
$ wget https://launchpadlibrarian.net/298453058/libkrb5-3_1.14.3+dfsg-2ubuntu1_amd64.deb
$ wget https://launchpadlibrarian.net/298453060/libkrb5support0_1.14.3+dfsg-2ubuntu1_amd64.deb
$ sudo dpkg -i libkrb5support0_1.14.3+dfsg-2ubuntu1_amd64.deb
$ sudo dpkg -i libkrb5-3_1.14.3+dfsg-2ubuntu1_amd64.deb
$ sudo dpkg -i libgssapi-krb5-2_1.14.3+dfsg-2ubuntu1_amd64.deb
$ sudo dpkg -i openssh-client_7.3p1-1_amd64.deb
View twitch-extension.lua
--[[
Twitch.tv extension v0.0.2 by Stefan Sundin
https://gist.github.com/stefansundin/c200324149bb00001fef5a252a120fc2
The only thing that this extension does is to act as a helper to seek to the
correct time when you open a twitch.tv url that contains a timestamp.
You must have the playlist parser installed as well!
Usage:
1. Install the playlist parser: https://addons.videolan.org/p/1167220/
View download-slack-emoji.sh
#!/bin/bash
# get a token from https://api.slack.com/custom-integrations/legacy-tokens
# or if you don't have permissions to create one, you can inspect the Slack web client and you can get the one it is using
SLACK_TOKEN=
curl -q -s "https://slack.com/api/emoji.list?token=$SLACK_TOKEN" | jq -Mr '.emoji | to_entries | .[] | select(.value | startswith("http")) | "\(.key) \(.value)"' | sort | while read name url; do
fn="$name.${url##*.}"
echo "$fn"
curl -q -s -o "$fn" "$url"
done
View sh.sh
#!/bin/bash
# Put this file in C:\ and then run z-register.bat by right clicking it and using "Run as Administrator"
# Translate the windows path to the equivalent Bash on Windows path, then run it!
drive="${1:0:1}"
path="${1:2}"
"/mnt/${drive,,}${path//\\/\/}"
echo
read -p "Press enter key to close window..."
View nginx.firewall.plist
<!--
Forward port 80 to port 8080 and 443 to 8443 so that you can run nginx as a normal user.
Save to: /Library/LaunchDaemons/nginx.firewall.plist
Install by running:
sudo curl -L -o /Library/LaunchDaemons/nginx.firewall.plist https://gist.githubusercontent.com/stefansundin/f0ad99195333480157ce67e97c8d28c7/raw/nginx.firewall.plist
sudo launchctl load -Fw /Library/LaunchDaemons/nginx.firewall.plist
Uninstall:
sudo launchctl unload /Library/LaunchDaemons/nginx.firewall.plist
View git-bundle-hook.md

Make bundleing and npm installing easy

These git hooks runs bundle or npm install automatically whenever you:

  • git checkout a new branch with a different Gemfile or package.json.
  • git pull a change to Gemfile or package.json.

How to install

  1. cd awesome_git_repo
View youtube-global-shortcuts.user.js
// ==UserScript==
// @name YouTube global shortcuts
// @namespace https://gist.github.com/stefansundin/
// @homepage https://gist.github.com/stefansundin/65e3d6db697636d8e7f1
// @downloadURL https://gist.github.com/stefansundin/65e3d6db697636d8e7f1/raw/youtube-global-shortcuts.user.js
// @version 1.1
// @author Stefan Sundin
// @description Makes the YouTube shortcuts work even if the player is not focused.
// @icon https://www.youtube.com/favicon.ico
// @match https://www.youtube.com/*
View git-nuke
#!/bin/bash
set -o errexit
# BE VERY CAREFUL USING THIS SCRIPT. MAKE A BACKUP (OR TWO) FIRST WITH:
# git clone --mirror ...
# Install by putting this file in e.g. /usr/local/bin/git-nuke
# chmod +x /usr/local/bin/git-nuke
if [ $# -eq 0 ]; then