It's now here, in The Programmer's Compendium. The content is the same as before, but being part of the compendium means that it's actively maintained.
import avro.schema | |
import io, random | |
from avro.io import DatumWriter, DatumReader | |
import avro.io | |
# Path to user.avsc avro schema | |
schema_path="user.avsc" | |
schema = avro.schema.parse(open(schema_path).read()) | |
import Image | |
import sys | |
import glob | |
import ImageOps | |
# Trim all png images with white background in a folder | |
# Usage "python PNGWhiteTrim.py ../someFolder" | |
try: | |
folderName = sys.argv[1] |
[merge] | |
tool = vimdiff | |
[mergetool] | |
prompt = true | |
[mergetool "vimdiff"] | |
cmd = nvim -d $LOCAL $REMOTE $MERGED -c '$wincmd w' -c 'wincmd J' | |
[difftool] | |
prompt = false | |
[diff] | |
tool = vimdiff |
# Created by .ignore support plugin (hsz.mobi) | |
### Python template | |
# Byte-compiled / optimized / DLL files | |
__pycache__/ | |
*.py[cod] | |
*$py.class | |
# C extensions | |
*.so |
#!/bin/sh | |
# http://stackoverflow.com/a/38740102/874188 | |
for p; do | |
printf "/proc/%i/stat\0" "$p" | |
done | | |
xargs -r0 awk -v ticks="$(getconf CLK_TCK)" 'NR==1 { now=$1; next } | |
{ print strftime("%c " $1 " " $2, systime() - (now-($22/ticks))) } | |
' /proc/uptime |
func ComputeHmac256(message string, secret string) string { | |
key := []byte(secret) | |
h := hmac.New(sha256.New, key) | |
h.Write([]byte(message)) | |
return base64.StdEncoding.EncodeToString(h.Sum(nil)) | |
} |
This guide is for those who dares to install Windows 10 on slow netbooks (1GB of RAM).
Though Windows update program is over, you still may use old Windows product keys from license stickers to install Windows 10 on old machines.
UPD Jan 2019
This article is quite old, some instructions may be obsolete.
The assumed default setting in /etc/systemd/journald.conf
is Storage=auto
which implies that systemd journaling will only persist the journal if the expected storage location is available. Otherwise, the journal data is stored in memory and lost between reboots. On Ubuntu 16.04, /var/log/journal
does not exist by default. Create it to keep and query events from previous boots.
Considerations:
- Syslog still provides the persistant log records for Ubuntu 16.04, so enabling persistant systemd journal logging does cause a level of duplicaiton.
- There are sane defaults:
1.) Download a Nerd Font
2.) Unzip and copy to ~/.fonts
3.) Run the command fc-cache -fv
to manually rebuild the font cache