Skip to content

Instantly share code, notes, and snippets.

View sheran's full-sized avatar

Sheran Gunasekera sheran

View GitHub Profile
@sheran
sheran / userdata.yml
Created July 31, 2023 07:32
DO cloud-init file
#cloud-config
write_files:
- path: /etc/nixos/host.nix
permissions: '0644'
content: |
{ config, pkgs, ... }:
{
networking.firewall = {
enable = true;
allowedTCPPorts = [ 22 80 443 ];
@sheran
sheran / host.nix
Last active July 31, 2023 07:33
Set up Podman on NixOS [DigitalOcean]
{ config, pkgs, ... }:
{
networking.firewall = {
enable = true;
allowedTCPPorts = [ 22 80 443 ];
interfaces.podman1 = {
allowedUDPPorts = [ 53 ]; # this needs to be there so that containers can look eachother's names up over DNS
};
};
@sheran
sheran / tailscale-keep
Created October 12, 2022 06:57 — forked from willangley/tailscale-keep
tailscale config for OpenWRT
/etc/init.d/tailscale
/etc/rc.d/*tailscale
/etc/tailscale/
/lib/upgrade/keep.d/tailscale
/usr/sbin/tailscale
/usr/sbin/tailscaled

Keybase proof

I hereby claim:

  • I am sheran on github.
  • I am chopstick_ (https://keybase.io/chopstick_) on keybase.
  • I have a public key ASBu3mJt1PC2Y0P09oveVJ9ymv8xegKx-BmCPMFTN25axwo

To claim this, I am signing this object:

@sheran
sheran / search.sh
Created August 28, 2020 06:32
Shell script to find out if an APK file uses Android SafetyNet Attestation
#!/bin/zsh
for apk in *.apk; do
unzip -q $apk "classes*.dex"
for dex in *.dex; do
gg=`dextra -M $dex |grep "attest\t"|cut -f5 -d":"|grep Task|xargs|cut -f1 -d" "`
if [ ${#gg} -gt 0 ]; then echo "$apk,$dex,$gg"; fi
rm $dex
done
done
@sheran
sheran / remove_table.py
Created October 23, 2012 09:26
Remove a table from a Gzipped MySQL dump file
#!/usr/bin/env python
import fileinput
import re
import gzip
def checkmarker1(line, table_name):
line = line.strip('\n')
needle = re.compile('.*?Dumping data for table \`'+table_name+'\`.*')
@sheran
sheran / jnlp_crawler.py
Created October 14, 2011 17:35
Download all the jar files in a jnlp file for offline examination
#!/usr/bin/env python
#
# jnlp_crawler.py - Download all the jar files in a jnlp file for offline examination
# Sheran Gunasekera
#
from xml.dom.minidom import parse
from xml.parsers.expat import ExpatError
import urllib
import sys
@sheran
sheran / dbf2csv.py
Created October 11, 2011 17:24
Dump a DBase DBF file to stdout as a CSV file
#!/usr/bin/env python
#
# Dump a DBase DBF file to stdout as a CSV file
#
# Get dbfpy from http://dbfpy.sourceforge.net/ first
#
from dbfpy import dbf
import sys