Skip to content

Instantly share code, notes, and snippets.

inf = open('backup.ab', 'rb')
out = open('backup.tar', 'wb')
buf = inf.read(512)
while buf != '':
if buf[:8] == 'TWRP\x00\x00\x00\x00':
print "Skipping %r" % buf[:16]
buf = inf.read(512)
@AlD
AlD / rrd-32-to-64-bits.sh
Last active December 16, 2023 18:13
Fix „ERROR: This RRD was created on another architecture“ on Debian
debootstrap --arch=i386 --include=rrdtool stable /tmp/rrdtool-i386 &&
mount --bind /var /tmp/rrdtool-i386/var &&
find /var -mount -type f -name \*.rrd |
while read rrd; do
td=$(mktemp -d)
linux32 chroot /tmp/rrdtool-i386 rrdtool dump "$rrd" > $td/xml &&
rrdtool restore $td/xml $td/rrd &&
cp $td/rrd "$rrd"
rm $td/{xml,rrd}
rmdir $td
<!doctype html><html itemscope="" itemtype="http://schema.org/SearchResultsPage" lang="de"><head><meta charset="UTF-8"><meta content="origin" name="referrer"><meta content="/images/branding/googleg/1x/googleg_standard_color_128dp.png" itemprop="image"><title>"googler" - Google Suche</title><script nonce="IdxAR7QuGcrVfj9gVHEWcQ==">(function(){
var b=window.addEventListener;window.addEventListener=function(a,c,d){"unload"!==a&&b(a,c,d)};}).call(this);(function(){window.google={kEI:'EEnlYfi_ErmZwbkPso-o8A4',kEXPI:'31',kBL:'FxAQ'};google.sn='web';google.kHL='de';})();(function(){
var f=this||self;var h,k=[];function l(a){for(var b;a&&(!a.getAttribute||!(b=a.getAttribute("eid")));)a=a.parentNode;return b||h}function m(a){for(var b=null;a&&(!a.getAttribute||!(b=a.getAttribute("leid")));)a=a.parentNode;return b}
function n(a,b,c,d,g){var e="";c||-1!==b.search("&ei=")||(e="&ei="+l(d),-1===b.search("&lei=")&&(d=m(d))&&(e+="&lei="+d));d="";!c&&f._cshid&&-1===b.search("&cshid=")&&"slh"!==a&&(d="&cshid="+f._cshid);c=c||"

Keybase proof

I hereby claim:

  • I am AlD on github.
  • I am ald (https://keybase.io/ald) on keybase.
  • I have a public key whose fingerprint is 4FB5 4FE3 021D 9738 85AF D0F5 A84E EFE6 7A2A 182A

To claim this, I am signing this object:

#!/bin/bash
sleep_cfg=/etc/systemd/sleep.conf.d/hibernate-reboot.conf
cleanup_cfg=/usr/lib/systemd/system-sleep/hibernate-reboot.sh
sudo mkdir -p "$(dirname "$sleep_cfg")" "$(dirname "$cleanup_cfg")"
sudo tee "$sleep_cfg" << ''
[Sleep]
HibernateMode=reboot
// stop quasselcore
select pg_get_indexdef('sender_sender_realname_avatarurl_uindex'::regclass);
alter table backlog alter constraint backlog_senderid_fkey deferrable;
set session_replication_role = replica;
begin;
create or replace temp view foo
as select min.senderid min_senderid, other.*
from
(select min(senderid) senderid, sender, realname, avatarurl
// ==UserScript==
// @name Amazon: Remove Sponsored Items
// @license BSD-3-Clause
// @namespace https://gist.github.com/AlD/cd505481d2972be02ce246e5368b08e8
// @updateURL https://gist.github.com/AlD/cd505481d2972be02ce246e5368b08e8/raw/amazon-remove-sponsored-items.user.js
// @downloadURL https://gist.github.com/AlD/cd505481d2972be02ce246e5368b08e8/raw/amazon-remove-sponsored-items.user.js
// @version 0.9.4
// @description Amazon: Remove sponsored items in search results
// @author Daniel Albers <daniel@lbe.rs>
// @match https://*.amazon.de/*
// ==UserScript==
// @name Amazon Smile Redirect
// @license BSD-3-Clause
// @namespace https://gist.github.com/AlD/e288d567bc581c97f4a3a4bc1bf5d447
// @updateURL https://gist.github.com/AlD/e288d567bc581c97f4a3a4bc1bf5d447/raw/amazon-smile-redirect.user.js
// @downloadURL https://gist.github.com/AlD/e288d567bc581c97f4a3a4bc1bf5d447/raw/amazon-smile-redirect.user.js
// @version 0.3.0
// @description Redirect from regular Amazon to Amazon Smile
// @author Daniel Albers <daniel@lbe.rs>
// @match https://www.amazon.de/*
#!/bin/bash
pa_host=pahostname.local
while IFS=": " read key value; do
export PULSE_${key^^}=$value
echo PULSE_${key^^}=$value
done < <(ssh -TNfL 4713:127.1:4713 "$pa_host" 'DISPLAY=:0 pax11publish -d')
"$@"
@AlD
AlD / gtfo.java
Last active August 30, 2016 22:38
Just as a hint; this is how many "secure" Android apps check for a rooted phone
import android.content.Context;
import android.content.pm.PackageManager;
import android.os.Build;
import java.io.File;
import java.util.ArrayList;
import java.util.Iterator;
final class zx
{