Skip to content

Instantly share code, notes, and snippets.

View JerryFleming's full-sized avatar

Jerry Fleming JerryFleming

View GitHub Profile
@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 <[email protected]>,
# 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 / 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 <[email protected]> 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 / 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 <[email protected]>
#
# SYNOPSIS:
# backup -- does everything
# backup file -- start from here directly
# backup file only -- for this file only
@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 <[email protected]> on 2013-03-25.
# No rights reserved. Use at your own risk.
import sqlite3
import re
@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 <[email protected]> on 2013-03-25.
# No rights reserved. Use at your own risk.
import sqlite3
import datetime
import re
@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 <[email protected]> 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 / 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 <[email protected]>
# on 2013-03-25.
# No rights reserved. Use at your own risk.