Skip to content

Instantly share code, notes, and snippets.

View wiredfool's full-sized avatar
💭
Feline

wiredfool wiredfool

💭
Feline
View GitHub Profile
#!/bin/sh
KERNEL="vmlinuz-4.4.0-112-generic"
INITRD="initrd.img-4.4.0-112-generic"
CMDLINE="earlyprintk=serial console=ttyS0 acpi=off root=/dev/vda1 ro"
MEM="-m 1G"
SMP="-c 2"
NET="-s 2:0,virtio-net"
IMG_HDD="-s 4,virtio-blk,hd.raw"
@wiredfool
wiredfool / gist:3e8aedea816d52376221b5ee0dd16285
Created March 4, 2018 12:15
For figuring out where stuff is called when deep in web frameworks.
import inspect;
stack = "".join("""%s:%s %s\n%s""" %(f.filename, f.lineno, f.function, f.code_context[0])
for f in inspect.stack()[1:10])
logger.debug(stack)
@wiredfool
wiredfool / clfontpng.cc
Created December 5, 2016 10:57 — forked from jokertarot/clfontpng.cc
How to render color emoji font with FreeType 2.5
// = Requirements: freetype 2.5, libpng, libicu, libz, libzip2
// = How to compile:
// % export CXXFLAGS=`pkg-config --cflags freetype2 libpng`
// % export LDFLAGS=`pkg-config --libs freetype2 libpng`
// % clang++ -o clfontpng -static $(CXXFLAGS) clfontpng.cc $(LDFLAGS) \
// -licuuc -lz -lbz2
#include <cassert>
#include <cctype>
#include <iostream>
#include <memory>
@wiredfool
wiredfool / .emacs
Created December 15, 2015 11:27
Make M-x grep work with Emacs/Windows when Babun is installed
;; Make M-x grep work with Emacs/Windows when Babun is installed
;; Put in your .emacs file.
(when (string-equal system-type "window-nt")
(progn
(setq babun-bin (concat (getenv "HOMEDRIVE") (getenv "HOMEPATH") "\\.babun\\cygwin\\bin")
(setenv "PATH" (concat (getenv "PATH") ";" babun-bin))
))
{
"Statement": [
{
"Action": [
"route53:ChangeResourceRecordSets",
"route53:GetHostedZone",
"route53:ListResourceRecordSets"
],
"Effect": "Allow",
"Resource": [
@wiredfool
wiredfool / gist:9aede43e76f0c13c1e2e
Last active August 29, 2015 14:04
Font opacity
from PIL import Image, ImageDraw, ImageFont
# get an image
base = Image.open('Pillow/Tests/images/lena.png').convert('RGBA')
# make a blank image for the text
txt = Image.new('RGBA', base.size)
# get a font
fnt = ImageFont.truetype('Pillow/Tests/fonts/FreeMono.ttf', 40)
d = ImageDraw.Draw(txt) # drawing context
from tester import *
from PIL import Image, FontFile, PcfFontFile
from PIL import ImageFont, ImageDraw
codecs = dir(Image.core)
if "zip_encoder" not in codecs or "zip_decoder" not in codecs:
skip("zlib support not available")
sudo apt-get install pypy
sudo apt-get install libjpeg8-dev zlib1g-dev libfreetype6-dev
git clone https://github.com/wiredfool/Pillow.git
virtualenv -p /usr/bin/pypy vpypy
source vpypy/bin/activate
cd Pillow/
python setup.py install
python Tests/test_imagefont.py --installed
@wiredfool
wiredfool / gist:8058899
Created December 20, 2013 18:11
py3.3 pillow build failure
(vpy33-dbg)[erics@localhost Pillow]$ python setup.py install
setup.py:76: ResourceWarning: unclosed file <_io.BufferedReader name='README.rst'>
return open(file, 'rb').read()
setup.py:76: ResourceWarning: unclosed file <_io.BufferedReader name='CHANGES.rst'>
return open(file, 'rb').read()
running install
running bdist_egg
running egg_info
writing top-level names to Pillow.egg-info/top_level.txt
writing Pillow.egg-info/PKG-INFO
@wiredfool
wiredfool / gist:7938963
Created December 13, 2013 02:24
10.7 sudoers file
# sudoers file.
#
# This file MUST be edited with the 'visudo' command as root.
# Failure to use 'visudo' may result in syntax or file permission errors
# that prevent sudo from running.
#
# See the sudoers man page for the details on how to write a sudoers file.
#
# Host alias specification