Skip to content

Instantly share code, notes, and snippets.

@Aaron-Macneill
Aaron-Macneill / flush.sh
Created August 27, 2018 12:34
Bash bcache flush #bcache
#!/bin/bash
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit
fi
trap finish EXIT
get_dirty () {
@Aaron-Macneill
Aaron-Macneill / fls.go
Created April 12, 2018 15:13
ls clone in go. It's slightly faster than ls in directories with lots of files
package main
import (
"fmt"
"github.com/fatih/color"
"io/ioutil"
)
var (
fileColor = color.New(color.FgCyan)
@Aaron-Macneill
Aaron-Macneill / list.go
Created March 28, 2018 21:21
Quick listing thing for gokrazy
package main
import (
"fmt"
"github.com/gokrazy/gokrazy"
"log"
"net/http"
"path/filepath"
)
@Aaron-Macneill
Aaron-Macneill / autohide.sh
Created March 5, 2018 20:35
A script to autohide polybar using xdo and xwininfo
#!/bin/sh
# Get Polybar ID
id=$(xdo id -N "Polybar")
# If Polybar is viewable hide it. Otherwise, show it.
if xwininfo -id $id | grep -q "IsViewable"; then
xdo hide -N "Polybar"
else
xdo show -N "Polybar"
@Aaron-Macneill
Aaron-Macneill / flush_bcache.py
Created March 5, 2018 00:07
Flushing bcache via an automated python script
#!/usr/bin/python3
import time
import os
dirty_data_path = "/sys/block/bcache0/bcache/dirty_data"
writeback_path = "/sys/block/bcache0/bcache/writeback_percent"
def get_writeback():
with open(writeback_path, 'r') as f:
return int(f.read())
@Aaron-Macneill
Aaron-Macneill / GoGet.sh
Created October 8, 2017 21:51
go get script
#!/bin/bash
PACKAGE=${1#*//}
go get $PACKAGE