Skip to content

Instantly share code, notes, and snippets.

@jayme-github
jayme-github / move_kwallet_folder_entries.py
Last active December 17, 2015 00:29
I recently switched from chromium to chrome which results in a new KWallet "Chrome Form Data" folder and the loss of my stored passwords and form data. I thought something like 'okay, I just copy the entries from the old folder' but oops - KWallet GUI does not support this. So here is a quick and dirty script to copy all entries from one folder …
#!/usr/bin/python
# -*- coding: utf-8 -*-
## http://api.kde.org/pykde-4.3-api/kdeui/KWallet.Wallet.html
from PyKDE4.kdeui import KWallet
from PyQt4.QtGui import QApplication
import sys
FROM = None
from django.db import models
# http://www.djangosnippets.org/snippets/562/#c673
# https://gist.github.com/fission6/2587518
class QuerySetManager(models.Manager):
# http://docs.djangoproject.com/en/dev/topics/db/managers/#using-managers-for-related-object-access
# Only works for OneToOne relations...:
# https://code.djangoproject.com/ticket/14891
use_for_related_fields = True
import time
import re
import os
import requests
from Crypto.PublicKey import RSA
from Crypto.Cipher import PKCS1_v1_5
from cookielib import LWPCookieJar
import ConfigParser
from base64 import b64encode
@jayme-github
jayme-github / CouchPotato-xREL.user.js
Last active October 16, 2015 20:58
CouchPotato xREL
// ==UserScript==
// @name CouchPotato xREL
// @author jayme-github
// @namespace https://github.com/jayme-github/
// @downloadURL https://gist.githubusercontent.com/jayme-github/becb38ac3577574df74e/raw/CouchPotato-xREL.user.js
// @version 0.1
// @description add xREL search link to wanted page
// @match http://192.168.2.240:8083*
// @match http://127.0.0.1:8083*
// @require http://code.jquery.com/jquery-latest.min.js
@jayme-github
jayme-github / ForceEnglishMSKB.user.js
Created August 12, 2015 10:31
Tampermonkey/Greasemonkey script to force the MS Knowledgebase to english
// ==UserScript==
// @name ForceEnglishMSKB
// @author jayme-github
// @namespace https://github.com/jayme-github/
// @downloadURL https://gist.githubusercontent.com/jayme-github/2aa6ec4b5f319df495e8/raw/ForceEnglishMSKB.user.js
// @version 0.1
// @description Force the MS Knowledgebase to english
// @match https://support.microsoft.com/*/kb/*
// @copyright 2015+, jayme-github
// ==/UserScript==
@jayme-github
jayme-github / BugzillaCommentsUseSpace.user.js
Last active August 29, 2015 14:27
Tampermonkey/Greasemonkey script to use all available space to display bugzilla comments (no stupid line breaks)
// ==UserScript==
// @name BugzillaCommentsUseSpace
// @author jayme-github
// @namespace https://github.com/jayme-github/
// @downloadURL https://gist.githubusercontent.com/jayme-github/7ff9e834d6cdbe29a341/raw/BugzillaCommentsUseSpace.user.js
// @version 0.1
// @description Use all available space to display comments (no stupid line breaks)
// @match http*://*/bugzilla/show_bug.cgi?id=*
// @copyright 2015+, jayme-github
// ==/UserScript==
@jayme-github
jayme-github / PyQtVirtualenv.CheatSheet.sh
Last active September 8, 2015 08:20
Installl PyQT in virtualenv
NEWENV="goodname"
PY="$(which python3)"
mkvirtualenv -p "$PY" --always-copy "$NEWENV"
mkdir ~/.virtualenvs/$NEWENV/build
cd ~/.virtualenvs/$NEWENV/build
# SIP
wget http://sourceforge.net/projects/pyqt/files/sip/sip-4.16.9/sip-4.16.9.tar.gz
tar xfz sip-4.16.9.tar.gz
cd sip-4.16.9
@jayme-github
jayme-github / Posteo.user.js
Last active December 1, 2015 10:32
Some small improvements for posteo.de webmailer (use calendar event color as background instead of border only, remove elements that waste screen space)
// ==UserScript==
// @name Posteo
// @author jayme-github
// @copyright 2015+, jayme-github
// @namespace https://github.com/jayme-github/
// @downloadURL https://gist.github.com/jayme-github/65fa98d25f29062f5861/raw/Posteo.user.js
// @version 0.1
// @description Some small improvements for posteo.de webmailer
// @match https://posteo.de/webmail*
// @match https://posteo.de/hilfe*
@jayme-github
jayme-github / BusinessHours.py
Created December 15, 2015 08:35
BusinessHours
# Based on BusinessHours written by
# Antano Solar John "solar_ant" <solar345@gmail.com>
# Sponsored by Ma Foi
#
# (C)2006-2007 All Rights Reserved,
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
@jayme-github
jayme-github / aads_oauth2.py
Created December 22, 2015 08:25
Azure Active Directory Service OAuth2 flow
import os
import jwt
import logging
from requests_oauthlib import OAuth2Session
os.environ['OAUTHLIB_INSECURE_TRANSPORT'] = '1' # For testing only
LOGFMT = '%(asctime)s (%(name)s.%(funcName)s) [%(levelname)s] %(message)s'
logging.basicConfig(format=LOGFMT, level=logging.DEBUG)
'''