Skip to content

Instantly share code, notes, and snippets.

@iwconfig
iwconfig / execute-scripts.sh
Last active June 12, 2024 05:38
stuff i use
#!/bin/bash
## A simple script which is set in the Transmission config to execute one script after the other.
## In this case 'cleaned-public-torrents.sh' after filebot has processed the file(s).
# Copyright 2016 iwconfig
/bin/bash /home/osmc/.config/transmission-daemon/userscripts/filebot-watch-transmission.sh && wait
if [ ! "$(pidof /bin/filebot)" ]; then
/bin/bash /home/osmc/.config/transmission-daemon/userscripts/cleanup-public-torrents.sh
fi
@iwconfig
iwconfig / imdb.png
Created June 25, 2016 15:07
imdb logo image data
'data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%007%00%00%00%1A%08%06%00%00%00%13%E9%C4%AE%0' +
'0%00%00%19tEXtSoftware%00Adobe%20ImageReadyq%C9e%3C%00%00%03%FFiTXtXML%3Acom.adobe.xmp%00%00%00%00%0' +
'0%3C%3Fxpacket%20begin%3D%22%EF%BB%BF%22%20id%3D%22W5M0MpCehiHzreSzNTczkc9d%22%3F%3E%20%3Cx%3Axmpmet' +
'a%20xmlns%3Ax%3D%22adobe%3Ans%3Ameta%2F%22%20x%3Axmptk%3D%22Adobe%20XMP%20Core%205.3-c011%2066.14566' +
'1%2C%202012%2F02%2F06-14%3A56%3A27%20%20%20%20%20%20%20%20%22%3E%20%3Crdf%3ARDF%20xmlns%3Ardf%3D%22h' +
'ttp%3A%2F%2Fwww.w3.org%2F1999%2F02%2F22-rdf-syntax-ns%23%22%3E%20%3Crdf%3ADescription%20rdf%3Aabout%' +
'3D%22%22%20xmlns%3AxmpMM%3D%22http%3A%2F%2Fns.adobe.com%2Fxap%2F1.0%2Fmm%2F%22%20xmlns%3AstRef%3D%22' +
'http%3A%2F%2Fns.adobe.com%2Fxap%2F1.0%2FsType%2FResourceRef%23%22%20xmlns%3Axmp%3D%22http%3A%2F%2Fns' +
'.adobe.com%2Fxap%2F1.0%2F%22%20xmlns%3Adc%3D%22http%3A%2F%2Fpurl.org%2Fdc%2Felements%2F1.1%2F%22%20x' +
'mpMM%3AOriginalDocumentID%3D%22xmp.did%3A5F301BE2996FE111AB6EFFEEC0DD0C6F%22%2
@iwconfig
iwconfig / svtplej.user.js
Last active July 1, 2016 14:15
userscript, works with tampermonkey
// ==UserScript==
// @name svtplej
// @namespace https://github.com/iwconfig
// @version 0.2
// @description adds link to imdb search and link to a server which downloads the video for me
// @author iwconfig
// @match http://*.svtplay.se/*
// @grant GM_addStyle
// @run-at document-idle
// ==/UserScript==
@iwconfig
iwconfig / chromium-extension-downloader.py
Last active May 15, 2019 05:55
Install script for ungoogled-chromium. It downloads deb files for Ubuntu Xenial Xerus 16.04 and installs with dpkg. Used on Gallium Os without problems.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from json import dumps
import requests
import re
import sys
import os
# Given the extension url(s) as parameter(s) it downloads the extension(s) to '$HOME/Downloads',
# and creating a .json file in '/usr/share/chromium/extensions'. Next time Chromium starts up,
Chromebook Search key shortcut to open startmenu. (i.e. 'xfce4-popup-whiskermenu')
Alternatively 'xfce4-popup-applicationsmenu', 'xfce4-appfinder' or 'xfce4-appfinder --collapsed'
xfconf-query --create --channel xfce4-keyboard-shortcuts --property '/commands/custom/Overlay1_Enable' --type string --set 'xfce4-popup-whiskermenu'
Start Chromium browser / open new window with Ctrl+Alt+C.
While running, Ctrl+N works aswell, even a little smoother (native global shortcut).

xfconf-query --create --channel xfce4-keyboard-shortcuts --property '/commands/custom/c' --type string --set 'chromium'

@iwconfig
iwconfig / user.js
Created October 9, 2016 16:31
Firefox privacy and security settings done by Pants (and others, see info in script), with some minor changes done by me so Firefox is a little more nifty. Things like history and search in urlbar.
/******
* name: ghacks user.js
* date: 02 July 2016
* version: 0.10
* FF version: 47 (DESKTOP)
* author: Pants (v10 special thanks to ghacks contributors: Just me, Conker, earthling, & Rockin' Jerry)
* url: http://www.ghacks.net/2015/08/18/a-comprehensive-list-of-firefox-privacy-and-security-settings/
* required reading: http://kb.mozillazine.org/User.js_file
* README/IMPORTANT:
@iwconfig
iwconfig / wget.sh
Created January 28, 2017 12:40
barebone bash downloader
## http://unix.stackexchange.com/a/83927
function __wget() {
: ${DEBUG:=0}
local URL=$1
local tag="Connection: close"
local mark=0
if [ -z "${URL}" ]; then
printf "Usage: %s \"URL\" [e.g.: %s http://www.google.com/]" \
"${FUNCNAME[0]}" "${FUNCNAME[0]}"
@iwconfig
iwconfig / reconnecting-websocket.min.js
Created March 15, 2017 02:08
Minified version of reconnecting-websocket.js. See https://github.com/bebo/reconnecting-websocket (c) Joe Walnes
!function(a,b){"function"==typeof define&&define.amd?define([],b):"undefined"!=typeof module&&module.exports?module.exports=b():a.ReconnectingWebSocket=b()}(this,function(){function a(b,c,d){function l(a,b){var c=document.createEvent("CustomEvent");return c.initCustomEvent(a,!1,!1,b),c}var e={debug:!1,automaticOpen:!0,reconnectInterval:1e3,maxReconnectInterval:3e4,reconnectDecay:1.5,timeoutInterval:2e3,maxReconnectAttempts:null,binaryType:"blob"};d||(d={});for(var f in e)"undefined"!=typeof d[f]?this[f]=d[f]:this[f]=e[f];this.url=b,this.reconnectAttempts=0,this.readyState=WebSocket.CONNECTING,this.protocol=null;var h,g=this,i=!1,j=!1,k=document.createElement("div");k.addEventListener("open",function(a){g.onopen(a)}),k.addEventListener("close",function(a){g.onclose(a)}),k.addEventListener("closing",function(a){g.onclosing(a)}),k.addEventListener("connecting",function(a){g.onconnecting(a)}),k.addEventListener("onmaxretry",function(a){g.onmaxretry(a)}),k.addEventListener("message",function(a){g.onmessage(a)}),k.
@iwconfig
iwconfig / open-terminal.py
Created October 14, 2017 22:42
Open terminal in current or selected folder in Nautilus file manager. Supports locales - please add your transation(s) if you want.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# NOTE: This is based on 'open-terminal.py' example originally written by Martin Enlund. My version is a bit more comprehensive.
# - Locales (please feel free to add more)
# - Tries to start the default terminal application in multiple different ways (all i could think of at the moment, please add more [self.executables])
# - Display different label depending on what is selected.
# Background and file has the same label, and directory has its own.
#
# URLs: https://github.com/iwconfig
@iwconfig
iwconfig / .bashrc
Created March 7, 2018 02:49
A replace function. Like "[CMD] !!" but replacing the previous command instead if prefixing.
# A replace function. Like "[CMD] !!" but replacing the previous command instead if prefixing.
# Usage: __ [CMD]
function __() {
__=$(history -p \!\!)
[[ "$(echo '$__' | cut -d' ' -f1)" == "__" ]] && history -d $(history | tail -n1 | cut -d' ' -f2)
export __=${__/$(echo $__ | cut -d' ' -f1)/$1}
echo "$__"
$__
history -s "$__"
}