Skip to content

Instantly share code, notes, and snippets.

@simon816
simon816 / booklet.js
Last active September 23, 2023 20:04
Prevent soundcloud signup popup when scrubbing
javascript:LOOP:for(const e of webpackJsonp){let o=e[1];for(let n of Object.keys(o)){let t=o[n].toString();if(-1!==t.indexOf("shouldBlockScrubbing:function")){webpackJsonp.push([[],{[n]:function(o){o.exports={shouldBlockScrubbing:()=>!1,pauseAndPromptSignup(){}}}}]);break LOOP}}}
@simon816
simon816 / gvfs_reader.py
Last active August 30, 2019 15:47
Read GVFS Metadata files (~/.local/share/gvfs-metadata)
import struct
from collections import namedtuple
import datetime
# See https://github.com/GNOME/gvfs/blob/master/metadata/metatree.c
MAGIC = b'\xda\x1ameta'
MAJOR = 1
MINOR = 0
import sys
program = []
binding = None
for line in sys.stdin:
opcode, *rest = line.split(' ')
if opcode == '#ip':
binding = int(rest[0])
@simon816
simon816 / chrome_bookmark_checksum.py
Created August 21, 2018 16:15
Calculate Chrome bookmarks checksum
from hashlib import md5
# See https://chromium.googlesource.com/chromium/src/+/master/components/bookmarks/browser/bookmark_codec.cc
def regen_checksum(roots):
digest = md5()
def digest_url(url):
digest.update(url['id'].encode('ascii'))
digest.update(url['name'].encode('UTF-16-LE'))
@simon816
simon816 / decrypt.sh
Created August 15, 2018 20:48
Decrypt HTC LucyNotes data
#!/bin/bash
# copy /sdcard/.data/LucyNotes and /data/data/com.htc.lucy/databases/htcnotes.db
# into a directory with this script and run it
key=$(sqlite3 htcnotes.db "select v from kv where k='k'" | sed '/^$/d' | base64 -d | xxd -ps | paste -sd '' -)
iv=$(sqlite3 htcnotes.db "select v from kv where k='iv'" | sed '/^$/d' | base64 -d | xxd -ps | paste -sd '' -)
find LucyNotes/ -type f -name '*_e.*' | while read file; do
out=$(echo $file | sed s/_e././ | sed s/LucyNotes/LucyNotes.decrypted/)
mkdir -p $(dirname "$out")
@simon816
simon816 / build.xml
Last active August 29, 2015 14:04
Modified ProjectRed MC1.6.4 ANT buildscript
<project name="Project: Red" basedir="../" default="test">
<property environment="env"/>
<property file="ProjectRed/build.properties"/>
<condition property="mod.build" value="${env.BUILD_NUMBER}" else="0">
<isset property="env.BUILD_NUMBER"/>
</condition>
<property name="src.dir" value="ProjectRed"/>
<property name="build.dir" value="build"/>
@simon816
simon816 / OperaDataStore.py
Created June 28, 2013 16:41
A class which will hopefully be able to decode and extract data from the OperaDataStoreV2.dat file which is Opera Moblie's storage.
import struct
import time
DATA_STORE_HEADER='P\x00\x00\x10\xe4\x00\x00\x10\x01\x00\x00\x00\xbe\r9G'
class OperaDataStore:
def __init__(self, filearg):
if isinstance(filearg,file):
self.file=filearg
else:
self.file=open(filearg)
self.file.seek(0)