Skip to content

Instantly share code, notes, and snippets.

@wkettler
wkettler / dd.py
Last active July 21, 2023 08:01
A Python wrapper for the GNU dd command.
from execute import execute, Retcode
def dd(ifile, ofile, bs, count=None, seek=None):
"""
Wrapper for the GNU dd command.
Inputs:
ifile (str): Input file
ofile (str): Output file
bs (str): Block size
@cdown
cdown / gist:5c5b53e1855d7812dfbc
Last active February 27, 2024 19:01
Debian chroot inside Arch
pacman -S wget # needed for debootstrap
curl -o /tmp/db.deb http://ftp.debian.org/debian/pool/main/d/debootstrap/debootstrap_1.0.60~bpo70+1_all.deb
mkdir /opt/debootstrap
cd /opt/debootstrap
ar x /tmp/db.deb
tar xf data.tar.gz
mkdir /opt/debian
anonymous
anonymous / setup_kiosk.sh
Created November 6, 2014 17:17
create a kiosk user
#!/bin/bash
# This script
# - creates a user (named below)
# - sets up a union (aufs) filesystem on top of the users immutable home
# - creates a cleanup script (/usr/local/bin/cleanup.sh) that empties the aufs
# layer on login/logout/boot
# - replaces the lightdm config
# - replaces rc.local to run the script
#
@eyecatchup
eyecatchup / secure_flashing_mako_lrx21t
Created November 22, 2014 13:06
The safest way to flash factory images - This is a manual step-by-step procedure to flash Android 5.0 (LRX21T) factory images onto the Nexus 4 (aka mako).
# Create a new working directory and cd into it
~$ mkdir -p /path/n4update && cd /path/n4update
# Download all files you need
/path/n4update$ wget --no-check-certificates https://dl.google.com/dl/android/aosp/occam-lrx21t-factory-51cee750.tgz
# Download openrecovery-twrp-2.8.2.0-mako.img from http://techerrata.com/browse/twrp2/mako to the same path
# Download CF-Auto-Root-mako-occam-nexus4.zip from http://autoroot.chainfire.eu to the same path
# Extract downloaded file archives
/path/n4update$ mkdir -p ./images && tar zxvf occam-lrx21t-factory-51cee750.tgz -C ./images
@hillar
hillar / molo2midi.js
Last active May 13, 2016 08:21
moloch sessions to midi
// ES6
/*
moloch sessions.csv field names
[ 'Protocol',
' First Packet',
' Last Packet',
' Source IP',
@chrisgilbert
chrisgilbert / gist:58f57c82f74162ed5c0f
Last active June 25, 2021 19:17
Run Ansible or Ansible-Playbook from Rundeck
#!/bin/bash
# Interpret whether the input needs to go to ansible, or ansible-playbook and run appropriately
# First update the git repos for each project
/usr/bin/update-git-repos
export ANSIBLE_FORCE_COLOR=1
export ANSIBLE_RETRY_FILES_ENABLED=False
@Tookmund
Tookmund / Debootstrap Install.rst
Last active April 5, 2024 20:20
Install Debian or Ubuntu like Arch

This guide is a best-effort to configure a system with just debootstrap.

It has been updated so as not to be actively incorrect as of June 2022, when I realized it was still being used, but it was first written in 2015 and I can't guarantee that it's not missing essential parts of the process.

If it breaks, you get to keep both pieces

  1. Download a Debian live standard CD: https://cdimage.debian.org/cdimage/release/current-live/amd64/bt-hybrid/
  2. Login with user:live (if needed, it will probably automatically login)
  3. Check that you have internet with ip a. If you're using ethernet it should already be connected, otherwise you'll need to configure interfaces(5) and probably wpa_supplicant(8)
@henrik
henrik / dokku_on_digital_ocean.md
Last active May 12, 2022 14:38
Notes from running Dokku on Digital Ocean.

My notes for Dokku on Digital Ocean.

These may be a bit outdated: Since I originally wrote them, I've reinstalled on a newer Dokku and may not have updated every section below.

Commands

Install dokku-cli (gem install dokku-cli) for a more Heroku-like CLI experience (dokku config:set FOO=bar).

# List/run commands when not on Dokku server (assuming a "henroku" ~/.ssh/config alias)

ssh henroku dokku

@m-ou-se
m-ou-se / replace-debian-with-arch.txt
Last active October 22, 2023 12:16
Instructions to replace a live Debian installation with Arch
# Download latest archlinux bootstrap package, see https://www.archlinux.org/download/
wget 'ftp://ftp.nluug.nl/pub/os/Linux/distr/archlinux/iso/latest/archlinux-bootstrap-*-x86_64.tar.gz'
# Make sure you'll have enough entropy for pacman-key later.
apt-get install haveged
# Install the arch bootstrap image in a tmpfs.
mount -t tmpfs none /mnt
cd /mnt
tar xvf ~/archlinux-bootstrap-*-x86_64.tar.gz --strip-components=1