Skip to content

Instantly share code, notes, and snippets.

View JerryFleming's full-sized avatar

Jerry Fleming JerryFleming

View GitHub Profile
@JerryFleming
JerryFleming / wallpapers.sh
Last active December 17, 2015 01:48
Update your wallpapers regularly (please don't be frequently) by polling wallpaperswide.com.
#!/bin/bash
# Update your wallpapager regularly.
# Preferrably installing it in your crontab:
#
# (crontab -l | sed '1,3d'; echo "# Update wallpager every half an hour."; echo "0,30 * * * * /path/to/wallpaper.sh") | crontab -
#
# by Jerry Fleming <jerryfleming2006@gmail.com>
# on 2013-03-25.
# No rights reserved. Use at your own risk.
@JerryFleming
JerryFleming / this.py
Last active June 26, 2019 13:06
Zen of Python, Chinese Ultimate Final Version. The script features short (shortest?) and unreadable string. Beat me, break me!
#!/usr/bin/python
# Zen of Python, Chinese Ultimate Final Version
# by Jerry Fleming <jerryfleming2006@gmail.com> at 2012-12-14
# No right reserved. Use at your own risk!
s = '''
x\x9cM\x90\xdbO\xc20\x18\xc5\xdf\xf9\xff\xff\x012%\x88K\x84\xb2\xb1Kwc\x9dv+\x17
g\xbb\x0b!\xd3\xe0D\xf0Ax\x00SHp\x89mb\xa2O\xcd\xef\xf4\x9c\xef\xebi\x8b\xdd\xa3
\x80\\\xb1\xe5\xf0\x18\xf6\xdaJ\x0b\x9d\xc6\x13\x89\xf0%Q\x05:\x07w%\xd1\xd42&P
\x1e\x12\xc7\x1f!\x15\xf8\xe0\x16\x03\x89x4-e\xb6r\xee$\xba_Z.\xd0OF\xe34\xb3
@JerryFleming
JerryFleming / sms_export.py
Last active December 17, 2015 01:48
Export SMS from you Android phones into HTML, friendly for webkit browsers (Chrome/Safari).
#!/usr/bin/python3
# Export SMS from you Android phones into HTML, friendly for webkit browsers (Chrome/Safari).
# This requires SL4A <https://code.google.com/p/android-scripting/>
# and Python3 <https://code.google.com/p/python-for-android/wiki/Python3>.
# by Jerry Fleming <jerryfleming2006@gmail.com> on 2013-03-25.
# No rights reserved. Use at your own risk.
import sqlite3
import datetime
import re
@JerryFleming
JerryFleming / format.py
Last active December 17, 2015 01:49
Format your phone book in Chinese locale.
#!/usr/bin/python3
# Format your phone book in Chinese locale.
# This requires SL4A <https://code.google.com/p/android-scripting/>
# and Python3 <https://code.google.com/p/python-for-android/wiki/Python3>.
# by Jerry Fleming <jerryfleming2006@gmail.com> on 2013-03-25.
# No rights reserved. Use at your own risk.
import sqlite3
import re
@JerryFleming
JerryFleming / backup.bash
Last active December 17, 2015 01:49
backup up android.
#/bin/bash
# Backup android device to make ROMs, typically
# for Galaxy Tab P1000.
# by Jerry Fleming <jerryfleming2006@gmail.com>
#
# SYNOPSIS:
# backup -- does everything
# backup file -- start from here directly
# backup file only -- for this file only
@JerryFleming
JerryFleming / init.sh
Last active December 17, 2015 01:49
This is a init script for initramfs/initrd which parses rootfs given by LABEL/UUID.
#!/bin/busybox sh
# Init for initram.
# by Jerry Fleming <jerryfleming2006@gmail.com> on 2013-03-25.
# No rights reserved. Use at your own risk.
# utility functions {{{
rescue_shell()
{
echo "Something went wrong. Dropping you to a shell."
echo "Please switch root manually."
@JerryFleming
JerryFleming / shutdown.sh
Last active April 18, 2018 03:00
Shutdown your PC with graphical confirm dialog.
#!/bin/bash
# Shutdown the system, with GUI confirm box.
# by Jerry Fleming <jerryfleming2006@gmail.com>,
# on Jun 7, 2013,
# improved on Dec 20, 2013, for systemd compatibility.
# Use at your own risks!
TIME=3 # Three minutes count down.
PATH=$PATH:/sbin # For the shutdown command to be found.
TITLE='Shutdown Confirm'
@JerryFleming
JerryFleming / dnspod.py
Last active December 26, 2015 12:08
Update dynamic ip address to point to your domains.
#!/usr/bin/python
# coding: utf8
# vim: ts=4 sts=4 fdm=marker
'''
%s <action> [option]
where action is:
update [force]: update dns.
generate [filter]: generate (filtered) dns record list for update.
'''
@JerryFleming
JerryFleming / chapters.py
Created March 25, 2014 12:49
Parse chapters for KingReader.apk
#!/usr/bin/python
# coding: utf-8
import sqlite3 as sqlite
import os.path
import struct
import re
from binascii import hexlify
PIN = re.compile(r'[  ]*[^  ]+(经卷|品)第[一二三四五六七八九十百千万]+($|\(|之)', re.U)
@JerryFleming
JerryFleming / 256colors.py
Created March 25, 2014 12:50
Display color blocks for ansi terminals.
#!/usr/bin/python
# coding: utf8
def c(color):
print "\x1b[0m\x1b[38;5;%sm█\x1b[1m█" % color,
print "System colors:"
for color in range(8):
c(color)
print "\x1b[0m"