Skip to content

Instantly share code, notes, and snippets.

View greyltc's full-sized avatar
💭
I may be slow to respond.

M. Greyson Christoforo greyltc

💭
I may be slow to respond.
View GitHub Profile
@greyltc
greyltc / dockerSuperClean.sh
Last active December 7, 2022 12:16
removes all traces of all docker containers/images from your system
#!/usr/bin/env bash
# this removes every single docker container, image and volume on your system
# bash <(curl --silent --location https://gist.github.com/greyltc/361d6abb69d50090e62e/raw)
#FORCE="--force"
echo "Cleaning up all the docker things!"
echo "Containers..."
for c in $(docker container ls --all --quiet)
do
@greyltc
greyltc / dockerClean.sh
Last active October 23, 2016 17:59
cleans up docker images/containers
#!/usr/bin/env bash
# docker cleanup (if you're not careful, docker loves to eat disk space)
# bash <(curl -L https://gist.github.com/greyltc/ea2b0fbc5e815af55768/raw)
echo "Cleaning up unneeded docker images."
docker stop $(docker ps -a -q) || echo "No container to stop"
docker rm $(docker ps -a -q) || echo "No container to remove"
docker rmi $(docker images -f "dangling=true" -q)
#!/usr/bin/env bash
# merge in changes from upstream
# mergeFromUpstream.sh URL
# bash <(curl -L https://gist.githubusercontent.com/greyltc/daaa6cd9e217eb2ce3e6/raw/91f640fc90f91345eeff03788879ea7c9450d8df/mergeFromUpstream.sh) $URL
git remote add upstream $1
git fetch upstream
git merge upstream/master
@greyltc
greyltc / sync-pi-kernel-hacking.sh
Last active March 10, 2016 11:45
script to keep aur repos up to date with github branches
#!/usr/bin/env bash
cd /tmp
git clone git@github.com:greyltc/pi-kernel-hacking.git
cd pi-kernel-hacking
git remote add pi2-default ssh+git://aur@aur.archlinux.org/linux-rpi2-default-git.git
git remote add pi2-latest ssh+git://aur@aur.archlinux.org/linux-rpi2-latest-git.git
git remote add pi3-default ssh+git://aur@aur.archlinux.org/linux-rpi3-default-git.git
git remote add pi3-latest ssh+git://aur@aur.archlinux.org/linux-rpi3-latest-git.git
@greyltc
greyltc / changeLineSpeed.sh
Created August 8, 2016 11:18
bash script to change interface to 100baseTx given its mac address
#!/usr/bin/env bash
set -eu -o pipefail
# this is the mac address of the interface we're interested in
MAC_OI="20:47:47:f8:f4:71"
for i in /sys/class/net/* ; do
I_MAC=$(cat $i/address)
INTERFACE=$(basename $i/)
if [ "$MAC_OI" = "$I_MAC" ]; then
@greyltc
greyltc / vgaswitcherooNotes.md
Last active August 14, 2016 12:33
graphics switching notes for macbook pro 5.1

Requirements:

  1. zcat /proc/config.gz | grep SWITCHEROO must return CONFIG_VGA_SWITCHEROO=y
  2. Kernel modesetting must be on from boot
    To do this, add nouveau to the MODULES array in /etc/mkinitcpio.conf:
    MODULES="... nouveau ..."
    then regenerate the initial ramdisk:
    mkinitcpio -p linux

Now,

@greyltc
greyltc / bup.sh
Last active December 25, 2016 18:59
encrypted backup to google drive
#!/usr/bin/env bash
# my backup script
# always requires three arguments:
# $1 = "upload" or "recover"
# $2 = encryption key
# $3 = target directory
# ===upload mode===
# Requires ~/.drive folder that das already been setup
# target directory is an absolute path to a folder to be encrypted and uploaded
# Puts backup files into a folder #encfs/targetName in google drive
@greyltc
greyltc / aviToMkv.sh
Last active March 23, 2017 09:02
convert all *.avi in a folder to to .mkv
#!/usr/bin/env bash
# pacman -S mkvtoolnix-cli
for f in *.avi; do mkvmerge -o "${f/.avi/.mkv}" "${f}"; done
@greyltc
greyltc / trace.log
Created February 23, 2017 11:36
kernel issue
Feb 23 11:33:03 carrot kernel: xhci_hcd 0000:0e:00.0: ERROR Transfer event TRB DMA ptr not part of current TD ep_index 2 comp_code 13
Feb 23 11:33:03 carrot kernel: xhci_hcd 0000:0e:00.0: Looking for event-dma 00000004a923d010 trb-start 00000004894e3fe0 trb-end 00000004894e3fe0 seg-start 00000004894e3000 seg-end 00000004894e3ff0
Feb 23 11:33:03 carrot kernel: xhci_hcd 0000:0e:00.0: ERROR Transfer event TRB DMA ptr not part of current TD ep_index 2 comp_code 13
Feb 23 11:33:03 carrot kernel: xhci_hcd 0000:0e:00.0: Looking for event-dma 00000004a923d020 trb-start 00000004894e3fe0 trb-end 00000004894e3fe0 seg-start 00000004894e3000 seg-end 00000004894e3ff0
Feb 23 11:33:03 carrot kernel: xhci_hcd 0000:0e:00.0: ERROR Transfer event TRB DMA ptr not part of current TD ep_index 2 comp_code 13
Feb 23 11:33:03 carrot kernel: xhci_hcd 0000:0e:00.0: Looking for event-dma 00000004a923d030 trb-start 00000004894e3fe0 trb-end 00000004894e3fe0 seg-start 00000004894e3000 seg-end 00000004894e3ff0
Feb 23 11:33:03 carrot kernel:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Fortran namelist parser. Converts nameslists to python dictionaries.
Should be fairly robust. Cannot be used for verifying fortran namelists as it
is rather forgiving.
Error messages during parsing are kind of messy right now.