This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# pip install dnspython | |
def myip(): | |
import socket | |
import dns.resolver | |
resolver = dns.resolver.Resolver() | |
resolver.nameservers = [socket.gethostbyname('resolver1.opendns.com')] | |
ans = resolver.query(qname='myip.opendns.com', rdtype='A', raise_on_no_answer=False) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
class T { | |
public: | |
T() { | |
std::cout << "T" << std::endl; | |
} | |
~T() { | |
std::cout << "~T" << std::endl; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# $Id: unsnap.sh,v 1.5 2008/12/12 13:35:58 cvs Exp $ | |
# | |
case "$1" in | |
*.old) | |
old="${1%/.old}" | |
old="${old%/}" | |
old="${old%/backups}" | |
old="${old%/}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# $Id: rc-snap.sh,v 1.9 2009/04/04 07:51:23 cvs Exp $ | |
# | |
mount_backup () { | |
base="${1}" | |
if test ! -d "${base}/.snap" | |
then | |
return |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
command -js gbm (function(){var a=window,b=buffer.doc,c=encodeURIComponent,d=a.openWebPanel("Google Bookmark", "https://www.google.com/bookmarks/mark?op=edit&output=popup&bkmk="+c(b.location)+"&title="+c(b.title));})(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The Kindle Touch's update system has a very annoying bug. The new new update format, each package is allowed to insert metadata into the header. The format is 0x2 byte number of meta-strings, then for each string, 0x2 byte for length of string followed by the string (without a null terminator). The problem is that Amazon themselves don't know if the length of the string is little endian or big endian. In libotacheck.so (which runs in the background and deletes invalid updates so you can't even run them from the menu), it assumes the length is little endian (like all other data in the file). Meanwhile, "bundlefuncs", which is called by otaup to extract and run the update assumes it is big endian. This means if I say my string is 0x10 bytes long, libotacheck.so will check to make sure I have a 0x1000 byte string. Now, there's no problem if I my file is big enough because right after the metadata is the actual update file (and currently, there is no use for metadata), however, if I have a small update package th |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I just realized that nobody ever posted detailed opening directions for the touch. Most just go "pry the bottom half first and remove the rest of the covers. It's really easy to damage the back, so here's some detailed instructions. I will define the "top" as where the kindle text is and the "bottom" as where the FCC text is. | |
The case is held together by 4 hooks on the top left and top right (2 left and 2 right) and 4 tabs tabs on the bottom left and right (2 and 2). There are also 6 very tiny tabs on the bottom and 4 on the top, but you should never start from the top because of the 4 hooks. Begin by taking a very thin piece of plastic (or anything thin and hard, but not a knife because you may damage something). Insert it into the bottom between the case and the device. Carefully pry until the bottom is loose. Now move your thin plastic to the right and left until you feel half the case loose. Do NOT attempt to pry the entire case off. As I've mentioned earlier, there are 4 hooks. With half the case loose, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http://en.wikipedia.org/wiki/ROT13 | |
abcdefghijklm | |
nopqrstuvwxyz | |
上下替换 | |
vim | |
=== |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set names utf8; |