Skip to content

Instantly share code, notes, and snippets.

@stefansundin
stefansundin / twitch-extension.lua
Last active November 26, 2023 13:32
VLC playlist parser for Twitch.tv - https://addons.videolan.org/p/1167220/
--[[
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/
@stefansundin
stefansundin / requests_api.py
Last active April 11, 2024 16:23
Reusable class for Python requests library.
# http://docs.python-requests.org/en/master/api/
import requests
class RequestsApi:
def __init__(self, base_url, **kwargs):
self.base_url = base_url
self.session = requests.Session()
for arg in kwargs:
if isinstance(kwargs[arg], dict):
kwargs[arg] = self.__deep_merge(getattr(self.session, arg), kwargs[arg])
@stefansundin
stefansundin / google-code-archive.rb
Created August 10, 2016 05:51
Export data from google-code-archive.
#!/usr/bin/env ruby
# https://code.google.com/archive/schema
# https://storage.googleapis.com/google-code-archive/v2/code.google.com/altdrag/project.json
require "httparty"
class CodeParty
include HTTParty
base_uri "https://storage.googleapis.com/google-code-archive/v2/code.google.com"
@stefansundin
stefansundin / Gemfile
Last active August 10, 2016 05:48
Use rack to host a static website.
source "https://rubygems.org"
gem "rack"
@stefansundin
stefansundin / manifest.json
Last active January 15, 2017 07:33
Replace YouPlay videos with YouTube on sweclockers.com
{
"name": "SweClockers YouTube embed",
"version": "1.1",
"description": "Trött på dålig videospelare?",
"content_scripts": [
{
"matches": ["*://www.sweclockers.com/*"],
"js": ["replace.js"],
"run_at": "document_end"
}
@stefansundin
stefansundin / compile-truecrypt-tails.md
Created May 15, 2016 23:01
Compile truecrypt in tails 2.3

compile truecrypt in tails 2.3

sudo apt-get install git build-essential devscripts debhelper pkg-config libgtk2.0-dev libfuse-dev nasm libappindicator-dev bash-completion
sudo apt-get install fakeroot

remove $(LIBS) from Main.make line 108 i.e. result: $(APPNAME): $(OBJS)

@stefansundin
stefansundin / background.js
Created May 2, 2016 03:18
WebRequest extension test that changes the response.
// The subsequent requests for the videofiles fails, but it was fun to test.
// http://www.oppetarkiv.se/
// https://developer.chrome.com/extensions/webRequest
chrome.webRequest.onBeforeRequest.addListener(
function(info) {
console.log(`Intercepted ${info.url}`);
return {redirectUrl: 'data:application/json,{"inSweden":true}'};
},
{
@stefansundin
stefansundin / github.rb
Last active May 1, 2016 00:30
Plot GitHub API rate limit usage with gnuplot.
#!/usr/bin/env ruby
# gem install httparty
require "httparty"
trap "SIGINT" do
STDERR.write "\nBye!"
exit 1
end
while true
@stefansundin
stefansundin / aws_maintenance_window.rb
Created April 12, 2016 01:15
Convert AWS maintenance window between timezones.
#!/usr/bin/env ruby
def offset_maintenance_window(w, offset=-7)
days = %w[mon tue wed thu fri sat sun]
if /(?<day_start>[a-z]{3}):(?<hour_start>\d\d):(?<minute_start>\d\d)-(?<day_end>[a-z]{3}):(?<hour_end>\d\d):(?<minute_end>\d\d)/ =~ w
day_start = days.find_index(day_start)
day_end = days.find_index(day_end)
hour_start = hour_start.to_i + offset
minute_start = minute_start.to_i
hour_end = hour_end.to_i + offset
<?php
/*
Made by Kudusch (blog.kudusch.de, kudusch.de, @Kudusch)
---------
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>