This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# https://gist.github.com/stefansundin/2d91d45580763cda29af | |
# Easily open a repo in a browser, just run `git open` | |
# Linux users need to change "open" to "xdg-open". | |
# Example installation instructions: | |
# curl -fL -o /usr/local/bin/git-open https://gist.githubusercontent.com/stefansundin/2d91d45580763cda29af/raw/git-open | |
# chmod +x /usr/local/bin/git-open | |
ORIGIN=`git config --get remote.origin.url | sed -e 's/\.git$//'` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# I have been annoyed that hash[:key] != hash["key"], which has caused problems more than once when converting things to Sidekiq jobs, etc. | |
# This is a major hack, and it is probably not really useful unless you can monkey patch the Hash class, which I didn't succeed with. | |
# I will have to look into how Rack does the params magic... | |
class StringHash < Hash | |
def []=(key, val) | |
super(key.to_s, val) | |
end | |
def [](key) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <windows.h> | |
// FILETIME is always UTC. Note that Windows itself will display timestamps in your local timezone, e.g. in the file properties dialog. | |
// Error codes: http://msdn.microsoft.com/en-us/library/windows/desktop/ms681381(v=vs.85).aspx | |
// i686-w64-mingw32-gcc -o filetime filetime.c | |
int main(int argc, char *argv[]) { | |
if (argc < 2) { | |
fprintf(stderr, "Usage: filetime <file> [new mtime] ...\n"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==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/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 sys |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<Module> | |
<ModulePrefs title="Disqus embed" author="Stefan Sundin" width="640" height="390"></ModulePrefs> | |
<UserPref name="shortname" datatype="string" default_value="" /> | |
<UserPref name="id" datatype="string" default_value="" /> | |
<UserPref name="url" datatype="string" default_value="" /> | |
<UserPref name="title" datatype="string" default_value="" /> | |
<UserPref name="width" datatype="string" default_value="" /> | |
<UserPref name="height" datatype="string" default_value="" /> | |
<UserPref name="args" datatype="string" default_value="" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://gist.github.com/stefansundin/22259d6309f34084cb8e | |
require 'net/http' | |
require 'json' | |
require 'time' | |
require 'iso_country_codes' | |
slug = 'infected-mushroom-kipod-remix-contest' | |
dest = "indabamusic-#{slug}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Launchpad Download Count | |
// @namespace https://gist.github.com/stefansundin/ | |
// @homepage https://gist.github.com/stefansundin/f9df6c5e0fd184c60709 | |
// @downloadURL https://gist.github.com/stefansundin/f9df6c5e0fd184c60709/raw/launchpad-download-count.user.js | |
// @version 0.3 | |
// @author Stefan Sundin | |
// @description Gets the download count of your Launchpad packages. | |
// @icon https://launchpad.net/favicon.ico | |
// @match https://launchpad.net/~*/+archive/ubuntu/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://gist.github.com/stefansundin/9d95826a712096b24ae2 | |
// https://devblogs.microsoft.com/oldnewthing/?p=3023 | |
// gcc -s -o clop clop.c | |
// Usage: | |
// clop | gpg -v | |
// clop /u = output is printed in Unicode | |
// clop /a = output is printed in ANSI | |
// otherwise, output is printed in OEM codepage |