Skip to content

Instantly share code, notes, and snippets.

@endolith
endolith / Readme.txt
Last active July 23, 2024 18:43
Gnome to Wine color scraper
This is a Python script to extract GNOME/GTK's color scheme and apply it to Wine, so that the themes (approximately) match.
Instructions:
1. Set your Gnome theme as you would like it
2. Run with a command like "python wine_colors_from_gtk.py"
3. Restart any apps running in Wine. They should match the Gnome theme colors now.
Better description with screenshots here: http://www.endolith.com/wordpress/2008/08/03/wine-colors/
This is also stored on https://code.launchpad.net/~endolith/+junk/wine-color-scraper
@ajshort
ajshort / export-layers.py
Created November 26, 2010 03:51
GIMP Python script to export each layer as a separate image.
#!/usr/bin/env python
#
# A GIMP plugin to save each layer in an image as a separate file
from gimpfu import *
import os
def export_layers(img, drw, path, name):
img = img.duplicate()
char code[] = "\x31\xc0\xb0\x46\x31\xdb\x31\xc9\xcd\x80\xeb"\
"\x16\x5b\x31\xc0\x88\x43\x07\x89\x5b\x08\x89"\
"\x43\x0c\xb0\x0b\x8d\x4b\x08\x8d\x53\x0c\xcd"\
"\x80\xe8\xe5\xff\xff\xff\x2f\x62\x69\x6e\x2f"\
"\x73\x68\x4e\x41\x41\x41\x41\x42\x42\x42\x42";
int main(int argc, char **argv)
{
int (*func)();
func = (int (*)()) code;
(int)(*func)();
@thiagoalz
thiagoalz / Pense-Bem-Songs.pde
Created August 21, 2011 03:33
Arduino file to play Pense-Bem songs
/*
Welcome: 'egage',
GameSelected: 'CgC',
Correct: 'gCC',
Wrong: 'ec',
Fail: 'egec',
Winner: 'gggeCCC',
HighBeep: 'C',
LowBeep: 'c'
@turicas
turicas / example_image_utils.py
Created December 10, 2011 19:04
Layer on top of Python Imaging Library (PIL) to write text in images easily
#!/usr/bin/env python
# coding: utf-8
# You need PIL <http://www.pythonware.com/products/pil/> to run this script
# Download unifont.ttf from <http://unifoundry.com/unifont.html> (or use
# any TTF you have)
# Copyright 2011 Álvaro Justen [alvarojusten at gmail dot com]
# License: GPL <http://www.gnu.org/copyleft/gpl.html>
from image_utils import ImageText
@bpo
bpo / eval-hello.sh
Last active November 2, 2022 19:26
Redis Lua examples
redis-cli EVAL "$(cat hello.lua)" 0

Built-in Tools in Python

List of command line accessible tools built into the python standard library.

Encoding

Base64 en/decoding:

python -m base64 -d [file]

python -m base64 -e [file]

@cincodenada
cincodenada / rot.py
Created September 14, 2013 00:09
Quick binary rotation (rotl/rotr) in Python
def rotl(num, bits):
bit = num & (1 << (bits-1))
num <<= 1
if(bit):
num |= 1
num &= (2**bits-1)
return num
def rotr(num, bits):
@LunaCodeGirl
LunaCodeGirl / examples.sh
Created September 25, 2013 23:39
Figlet how to and examples
figlet "I've got something to say"
figlet -f thick "Make Tech ASCIIer"
date | figlet -f basic
@marioluan
marioluan / remover-acentos.js
Created October 10, 2013 18:27
Funcao marota para remover acentos de strings. Foi utilizado expressao regular em cima de caracteres representados na base hexadecimal.
/**
* Remove acentos de caracteres
* @param {String} stringComAcento [string que contem os acentos]
* @return {String} [string sem acentos]
*/
function removerAcentos( newStringComAcento ) {
var string = newStringComAcento;
var mapaAcentosHex = {
a : /[\xE0-\xE6]/g,
e : /[\xE8-\xEB]/g,