Skip to content

Instantly share code, notes, and snippets.

@flying-sheep
flying-sheep / article.tex
Created September 20, 2012 12:21
sinnvolle Minimalpräambel und Minitutorial für deutsche LaTeX-Dokumente
\documentclass{scrartcl} %„scrartcl“ statt „article“ bietet bessere Standardeinstellungen für deutschen Text (A4, Ränder, …)
%%%%%%%%%%%%%%%%%
% unverzichtbar %
%%%%%%%%%%%%%%%%%
\usepackage[utf8]{inputenc} %Diese Quellcodedatei ist UTF-8-kodiert. Einzig sinnvolles Text-Encoding der westlichen Welt seit Jahren.
\usepackage[T1]{fontenc} %Das resultierende PDF ist T1-enkodiert. Einzig sinnvolles PDF-Encoding (Umlaute, ß).
\usepackage[ngerman]{babel} %Sprache des automatisch eingefügten Textes, z.B. „Kapitel“ statt „Chapter“.
\usepackage[babel]{csquotes} %Den Befehl \enquote{} nutzen, um Anführungszeichen einzufügen, statt kryptischer Zeichen wie `" ''.
@flying-sheep
flying-sheep / dabblet.css
Created October 11, 2012 14:24 — forked from LeaVerou/dabblet.css
Scrolling shadows by @kizmarh, @LeaVerou, and @trueflyingsheep
/**
* Scrolling shadows by @kizmarh, @leaverou, and @trueflyingsheep
* Only works in browsers supporting background-attachment: local, CSS gradients, and masks
* Degrades gracefully
*/
html {
background: repeating-linear-gradient(45deg,
rgba(255,0,0,.1),
rgba(0,0,255,.1) 100px,
@flying-sheep
flying-sheep / PKGBUILD
Created November 7, 2012 00:28
pygraph pkgbuild
pkgname=python-graph
pkgver=1.8.2
pkgrel=3
pkgdesc='python-graph is a library for working graphs in Python'
arch=('any')
url='http://python-graph.googlecode.com'
license=('MIT')
depends=('python' 'python-distribute' 'python-dot')
source=(
"$url/files/python-graph-core-$pkgver.tar.gz"
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
"""A yet-to-be-disproven-as-safe python expression shell
Blacklisted functionalities include:
1. Anything containing '__', because introspection allows many, many hacks.
2. open(), because it allows you to overwrite files
3. memoryview(), because it manipulates memory (?)
4. help(), because it drops you into a manpage-reader with !shell access
5. eval(), exec(), compile(), because they allow code execution via constructable strings, circumventing #1
6. vars(), getattr(), because they allow attribute access via constructable strings, circumventing #1
@flying-sheep
flying-sheep / PKGBUILD
Last active December 15, 2015 21:09
java-swing-globalmenu PKGBUILD
# Maintainer: Bjoern Bidar <theodorstormgrade@gmail.com>
pkgname=java-swing-globalmenu
pkgver=165
pkgrel=3
pkgdesc="Globalmenu support for swing"
url="http://code.google.com/p/java-swing-ayatana"
arch=('i686' 'x86_64')
license=('MIT')
depends=('java-runtime=7' 'libunity')
makedepends=('jdk7-openjdk' 'svn' 'apache-ant' 'lsb-release')
@flying-sheep
flying-sheep / PKGBUILD
Created April 26, 2013 23:32
coffee-script PKGBUILD
# Maintainer: Gordin <9ordin @t gmail dot com>
# Contributor: Simon Lipp <aur@simon.lipp.name>
# Contributor: Chris Bolton <http://scr.im/chris-kun>
# Contributor: Sergei Lebedev <superbobry at gmail dot com>
# Contributor: flying sheep <flying-sheep@web.de>
pkgname=coffee-script
pkgver=1.6.2
pkgrel=2
pkgdesc='CoffeeScript is a little language that compiles into JavaScript.'
@flying-sheep
flying-sheep / Results.md
Last active December 17, 2015 00:29
Test for the i18n bug discovered on the KDE

As you can see, i18n seems to try to decode passed unicode strings with the ascii codec, while encoding the returned tring with utf-8. In python 2, apparently if the trying fails, the unicode object gets passed to something expecting bytes, while in python 3, the failing to encode with ascii already produces an Exception.

This way, regardless of python version, passing bytes objects that contain any utf-8 work, while unicode-containing strings that you didn’t manually encode to utf-8 byte strings don’t.

PS: The next best things to a documentation for it is this and of course the code.

const {CC, Cu, components} = require('chrome');
const {NetUtil} = Cu.import("resource://gre/modules/NetUtil.jsm");
const {TextReader} = require('sdk/io/file');
const MozFile = CC('@mozilla.org/file/local;1', 'nsILocalFile', 'initWithPath'),
FileInputStream = CC('@mozilla.org/network/file-input-stream;1', 'nsIFileInputStream', 'init'),
StreamLoader = CC('@mozilla.org/network/stream-loader;1', 'nsIStreamLoader', 'init'),
UnicodeConverter = CC('@mozilla.org/intl/scriptableunicodeconverter', 'nsIScriptableUnicodeConverter'),
ConverterInputStream = CC('@mozilla.org/intl/converter-input-stream;1', 'nsIConverterInputStream', 'init'),
InputStreamPump = CC('@mozilla.org/network/input-stream-pump;1', 'nsIInputStreamPump', 'init'),
@flying-sheep
flying-sheep / PKGBUILD
Created May 18, 2013 12:54
fixed Spyder PKGBUILD
pkgname=spyder-hg
_hgrepo=spyderlib
pkgver=2823
pkgrel=1
pkgdesc="Scientific PYthon Development EnviRonment providing MATLAB-like features (formerly pydee)"
arch=('i686' 'x86_64')
url="http://spyderlib.googlecode.com/"
license=('MIT')
depends=('python-qscintilla')
makedepends=('mercurial' 'setuptools')