Skip to content

Instantly share code, notes, and snippets.

@zb3
zb3 / grandis.c
Created December 27, 2017 14:47
A wrapper program for linux to find out why segfault happend
#include <string.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <wait.h>
#include <sys/ptrace.h>
#include <sys/user.h>
#include <stdlib.h>
#include <linux/ptrace.h>
#/*
TARGET=selfcompiled
CODE=$(cat <<'FILE_CONTENTS_DELIM'
//*/
// CODE STARTS HERE
@zb3
zb3 / mbledtls_anon_dh.patch
Created April 10, 2018 09:43
Add support for Anonymous Diffie-Hellman key exchange in MbedTLS. This patch is experimental and ADH is not secure.
diff -Naur mbedtls/include/mbedtls/config.h mbedtls-dh-anon/include/mbedtls/config.h
--- mbedtls/include/mbedtls/config.h 2018-04-10 11:30:33.713503768 +0200
+++ mbedtls-dh-anon/include/mbedtls/config.h 2018-04-10 11:38:50.001356927 +0200
@@ -637,6 +637,36 @@
#define MBEDTLS_ECDSA_DETERMINISTIC
/**
+ * \def MBEDTLS_KEY_EXCHANGE_DH_ANON_ENABLED
+ *
+ * Enable the ADH based ciphersuite modes in SSL / TLS.
@zb3
zb3 / colortrans.py
Last active October 8, 2019 17:07 — forked from hoov/colortrans.py
Convert values between RGB hex codes and xterm-256 color codes.
#! /usr/bin/env python
""" Convert values between RGB hex codes and xterm-256 color codes.
Nice long listing of all 256 colors and their codes. Useful for
developing console color themes, or even script output schemes.
Resources:
* http://en.wikipedia.org/wiki/8-bit_color
* http://en.wikipedia.org/wiki/ANSI_escape_code
@zb3
zb3 / rewritemenot.user.js
Last active May 20, 2022 06:18
RewriteMeNot - a userscript that prevents rewriting of google search result urls, so you can copy them (doesn't really prevent tracking, better extensions exist for that purpose). This is much simpler than other scripts and works only on www.google.com.
// ==UserScript==
// @name RewriteMeNot
// @namespace zb3.rmn
// @include https://www.google.com/*
// @version 1
// @run-at document-end
// ==/UserScript==
// Google can track us anyway, but rewriting search result urls so that we can't even copy them is pure assholery.
// Google should rewrite their behaviour, not urls.
@zb3
zb3 / sporttvp.user.js
Created November 20, 2022 16:28
Unblock TVP Sport streams when using uBlock Origin
// ==UserScript==
// @name sporttvp
// @namespace zb3.sporttvp
// @include https://sport.tvp.pl/*
// @version 1
// @run-at document-start
// ==/UserScript==
function inject() {
const assign = Object.assign;
@zb3
zb3 / README.md
Created December 23, 2022 17:24
Icy Tower Classic Mobile Patcher

Icy Tower Classic Mobile Patcher

If you suck at this game as much as I do (assuming that's even possible) and want to practice playing at the higher floors without constantly having to start from the first one, the idea of using the revive functionality probably came to your head. However, I'm certain the idea of paying real money for it most probably didn't (hopefully...).

Here's the brilliant, free solution: Icy Tower Classic Mobile Patcher. It will give you 2147483647 coins so that you can revive yourself 31 times in one game (but don't ask me why)...

Normally the solution would be to patch the APK to allow an infinite number of revives... But that would be easy, universal, reliable and extensible. You gotta admit that doesn't sound so "zb3"...

Therefore this solution is:

  • not easy - you need to execute the patcher on your PC while the device is connected each time you want to increase your coins amount
@zb3
zb3 / runthis.js
Created March 20, 2023 13:58
Search within wykop.pl PM's exchanged between a given user
(async function() {
const fetchOptions = {
headers: {
'Accept': 'application/json',
'Authorization': `Bearer ${localStorage.token}`,
'Cookie': document.cookie
},
method: 'GET'
};
@zb3
zb3 / get_my_fenix_tabs.py
Created April 8, 2023 20:07
Get open tabs in Fenix on Android
# tested on fenix 107
# obviously requires root
import json
import datetime
import sys
if len(sys.argv) > 1:
tab_files = [sys.argv[1]]
else:
@zb3
zb3 / merge_pdf.php
Last active August 18, 2023 13:50
Merge PDF files with custom titles using Ghostscript
<?php
// merge_pdf_files(['file1.pdf', 'file2.pdf', 'file3.pdf'], ["title a", "title b", "title c"], "outfile.pdf")
function encode_ps_base($str) { // <hex encoded UTF-16BE with BOM>
return '<'.bin2hex($str).'>';
}
function encode_ps_utf16($str) { // <hex encoded UTF-16BE with BOM>
$utf16be = "\xFE\xFF".mb_convert_encoding($str, 'UTF-16BE', 'UTF-8');
return encode_ps_base($utf16be);