Skip to content

Instantly share code, notes, and snippets.

@stefansundin
stefansundin / sourceforge-bigger-filename-column.user.js
Last active August 29, 2015 14:04
Userscript that makes the filename column bigger on SourceForge, because that shit is not responsive.
// ==UserScript==
// @name SourceForge bigger filename column
// @namespace https://gist.github.com/stefansundin/
// @homepage https://gist.github.com/stefansundin/f1e81a8f5281f6f4cac4
// @downloadURL https://gist.github.com/stefansundin/f1e81a8f5281f6f4cac4/raw/sourceforge-bigger-filename-column.user.js
// @version 0.2
// @author Stefan Sundin
// @description Makes the filename column bigger, saves you from lots of frustration.
// @match *://sourceforge.net/*/files/*
// ==/UserScript==
@stefansundin
stefansundin / error-handler.php
Last active August 29, 2015 14:05
Simple PHP error handler mailer.
<?php
# https://gist.github.com/stefansundin/789cc36ccfc75d0ca243
date_default_timezone_set("Europe/Stockholm");
// edit this function to be notified of script errors by email
function mail_error($error) {
return; // comment this line out and edit this function if you want to use this
$error["timestamp"] = strftime("%Y-%m-%d %T %z");
$error["ip"] = $_SERVER["REMOTE_ADDR"];
@stefansundin
stefansundin / google-project-hosting-download-counter.user.js
Last active August 29, 2015 14:06
Userscript that helps you count the total downloads for your Project Hosting projects.
// ==UserScript==
// @name Google Project Hosting total download count
// @namespace https://gist.github.com/stefansundin/
// @homepage https://gist.github.com/stefansundin/5ac159d384d3e4b3a036
// @downloadURL https://gist.github.com/stefansundin/5ac159d384d3e4b3a036/raw/google-project-hosting-download-counter.user.js
// @version 0.1
// @author Stefan Sundin
// @description Adds a total download count to the footer.
// @match *://code.google.com/p/*/downloads/list*
// ==/UserScript==
@stefansundin
stefansundin / bind.c
Last active September 30, 2023 00:51
Bind programs to specific network interface. (Linux)
/*
https://gist.github.com/stefansundin/e4fce00d97f7694c7a27
http://www.ryde.net/code/bind.c.txt
http://daniel-lange.com/archives/53-Binding-applications-to-a-specific-IP.html
*/
/*
Copyright (C) 2000 Daniel Ryde
This library is free software; you can redistribute it and/or
@stefansundin
stefansundin / keybase.md
Created September 21, 2014 20:47
Keybase proof

Keybase proof

I hereby claim:

  • I am stefansundin on github.
  • I am stefansundin (https://keybase.io/stefansundin) on keybase.
  • I have a public key whose fingerprint is 7301 7A35 249F 746F F6FF 91D2 7FA5 D4DA 2764

To claim this, I am signing this object:

@stefansundin
stefansundin / clop.c
Last active August 27, 2021 12:19
(Windows) clop.exe: like Mac's pbpaste.
// 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
@stefansundin
stefansundin / launchpad-download-count.user.js
Last active April 26, 2023 13:39
Userscript that shows you the download count for Launchpad packages. Be sure to go to the "View all builds" view. (Read the source code for notes!). Click the [Raw] button to install!
// ==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/*
@stefansundin
stefansundin / indabamusic-download.rb
Last active August 29, 2015 14:07
Download all remixes from an indabamusic campaign.
# 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}"
@stefansundin
stefansundin / disqus-gadget.xml
Last active August 29, 2015 14:12
Disqus google gadget embed (note: haven't used this in a long while)
<?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="" />
@stefansundin
stefansundin / extract-attachments.py
Last active September 27, 2022 18:54
Extract attachments from emails that Gmail doesn't allow you to download. This is dumb. Please use Python >= 3.4.
#!/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