Skip to content

Instantly share code, notes, and snippets.

@crass
crass / gdb_trace.py
Created February 8, 2023 03:12 — forked from stettberger/gdb_trace.py
GDB Function Call Trace
# Example Invocation:
#
# gcc test.c -o test -g
# TRACE_FUNCTIONS=fib TRACE_FILE=log gdb -x gdb_trace.py test
# cat log
#
# Log File Format:
#
# ('call', Parent Call ID, Call ID, Breakpoint Name, Symbol Name, Arguments)
# ('return', Call Id, Breakpoint Name, Return Value)
@crass
crass / RiseupVPN-NetworkManager.md
Last active January 19, 2024 15:03
Use RiseupVPN via NetworkManager

A short tutorial on using the RiseupVPN via NetworkManager's OpenVPN plugin.

I didn't want to run an extra binary.

First using a webbrowser download this CA certificate. This will allow us to securely communicate with various Riseup servers.

Next you'll want to download the user certificate and private key (all in one file). I use curl to do this because its easier. If you want to use your browser you'll need to add the Riseup CA cert to your browser's trusted root certs. curl -vL --cacert riseup-vpn.ca.crt -o riseup-vpn.pem https://api.black.riseup.net/3/cert

What's left is choosing an openvpn gateway. This command will show the available endpoints as a list of json objects. Some of the gateways have transport type "obfs4" which is a protocol for obsfucating vpn traffic. I ignore those endpoints because I don't think they are useable via the plain openvpn NetworkManager plugin (but I haven't verified that).

Keybase proof

I hereby claim:

  • I am crass on github.
  • I am crass (https://keybase.io/crass) on keybase.
  • I have a public key ASDW7OsoHr0t6dvabP8jw2ASq0olwvmFT6eUU6NE8wGmKgo

To claim this, I am signing this object:

@crass
crass / edit_initrd.sh
Created September 12, 2013 02:53
easily do basic editing of Ubuntu iso (and perhaps others)
#!/bin/bash
set -x
# see: https://help.ubuntu.com/community/LiveCDCustomization
# see: https://wiki.ubuntu.com/CustomizeLiveInitrd
TMP=${TMP:-/tmp}
INITRD=$(readlink -f "$1")
INITRDDIR="$TMP/$(basename "$INITRD").d"
OFILE=${2:-"$TMP/$(basename "$INITRD")"}
@crass
crass / gist:5988293
Created July 12, 2013 22:17
firebug extension update check
curl --trace /tmp/curltrace -i \
-H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:22.0) Gecko/20100101 Firefox/22.0' \
-H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' \
-H 'Accept-Language: en-US,en;q=0.5' \
-H 'Accept-Encoding: gzip, deflate' \
-H 'Cookie: __utma=150903082.823062721.1373600861.1373600861.1373600861.1; __utmz=150903082.1373600861.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)' \
-H 'Connection: keep-alive' \
-H 'Pragma: no-cache' \
-H 'Cache-Control: no-cache' \
'https://versioncheck.addons.mozilla.org/update/VersionCheck.php?reqVersion=2&id=firebug@software.joehewitt.com&version=1.11.4&maxAppVersion=22.*&status=userEnabled&appID={ec8030f7-c20a-464f-9b0e-13a3a9e97384}&appVersion=22.0&appOS=Linux&appABI=x86_64-gcc3&locale=en-US&currentAppVersion=22.0&updateType=97&compatMode=ignore'
@crass
crass / reload_repository.py
Created August 6, 2012 11:29
Reload selected repositories
#!/usr/bin/env python
# Copyright (C) 2012 Glenn Washburn
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
>>> class A(object):
... cvar = 1
... def __init__(self):
... self.ivar = 2
...
>>> a=A()
>>> a.cvar, a.ivar
(1, 2)
>>> a.__dict__
{'ivar': 2}
>>> class A(object):
... blah = []
... def hmm(self):
... self.blah.append("hmm")
...
>>> test = A()
>>> test.hmm()
>>> test.blah
['hmm']
>>> test2 = A()