Skip to content

Instantly share code, notes, and snippets.

@xim
xim / README.md
Last active November 4, 2015 18:08
QTBUG-49238

This code reproduces QTBUG-49238.

#include "grabberdialog.h"
#include <QDebug>
#include <QGuiApplication>
#include <QLabel>
#include <QPixmap>
#include <QPushButton>
#include <QScreen>
#include <QVBoxLayout>
#include <QWindow>
#!/bin/bash
# (C) 2008 Canonical Ltd.
# Author: Martin Pitt <[email protected]>
# License: GPL v2 or later
# modified by David D Lowe and Thomas Detoux
# Debian 7 support by pixline <[email protected]>
# It NEEDS /bin/bash, dash won't work (sed issues).
#
# Setup user and temporary home directory for guest session.
@xim
xim / mangareader-zoom.user.js
Created September 4, 2014 08:47
Mangareader zoom in as default
// ==UserScript==
// @name mangareader zoom in as default
// @namespace https://gist.github.com/xim
// @description Zooms in on manga pages by default at mangareader.net
// @include http://www.mangareader.net/*
// @version 1
// @grant none
// ==/UserScript==
document.getElementById('img').removeAttribute('width');
@xim
xim / mangastream-banner.user.js
Created September 4, 2014 08:45
Manga stream remove ad banners
// ==UserScript==
// @name Manga Stream remove ad banners
// @namespace https://gist.github.com/xim
// @description Removes and collapses right side ad on MangaStream, readms.com
// @include http://readms.com/*
// @version 1
// @grant none
// ==/UserScript==
var el = document.getElementById('reader-sky');
// ==UserScript==
// @name Facebook width adjustment
// @namespace https://gist.github.com/xim
// @description Make stuff wider on FB
// @include https://www.facebook.com/*
// @version 4
// @grant GM_addStyle
// @downloadURL https://gist.githubusercontent.com/xim/6bef9b52ab831b981909/raw/fbwidth.user.js
// ==/UserScript==
@xim
xim / bashrc.append
Last active December 20, 2015 11:29
Vim function for your .bashrc. Turns "vim file1:42 file2:1337" into "/usr/bin/vim file1 file2 -S (script that moves the cursor to the correct line)"
# vim file:34 otherfile:1337 -> Open files at respective lines. And in tabs!
vim() {
declare -a args
let fcount=0
hit_dashdash=
for arg in "$@" ;do
if [[ "$arg" =~ ^- && ! "$hit_dashdash" ]] ;then
args+=("$arg")
[[ "$arg" = "--" ]] && hit_dashdash=1
continue
@xim
xim / statements.py
Last active December 16, 2015 10:29
#!/usr/bin/env python
import re
statement_matcher = re.compile(r'^s(.)(?:(?!\1).)*\1(?:(?!\1).)*\1$')
def get_interesting_triplets(dictionary_file, statement_file):
with open(dictionary_file) as fh:
words = [word.strip() for word in fh.readlines()]
@xim
xim / custom-term.patch
Created September 24, 2012 07:18
Quick patch to oe to allow custom terminals.
diff --git a/meta/classes/terminal.bbclass b/meta/classes/terminal.bbclass
index 3cfc84b..906fa58 100644
--- a/meta/classes/terminal.bbclass
+++ b/meta/classes/terminal.bbclass
@@ -4,7 +4,7 @@ OE_TERMINAL[choices] = 'auto none \
${@" ".join(o.name \
for o in oe.terminal.prioritized())}'
-OE_TERMINAL_EXPORTS = 'XAUTHORITY SHELL DBUS_SESSION_BUS_ADDRESS DISPLAY EXTRA_OEMAKE SCREENDIR'
+OE_TERMINAL_EXPORTS += 'XAUTHORITY SHELL DBUS_SESSION_BUS_ADDRESS DISPLAY EXTRA_OEMAKE SCREENDIR'
@xim
xim / cluster_example.py
Created October 11, 2011 20:19
Clustering K-Means by euclidian distance, yay!
import sys
import numpy
from nltk.cluster import KMeansClusterer, GAAClusterer, euclidean_distance
import nltk.corpus
from nltk import decorators
import nltk.stem
stemmer_func = nltk.stem.EnglishStemmer().stem
stopwords = set(nltk.corpus.stopwords.words('english'))