Skip to content

Instantly share code, notes, and snippets.

View jxu's full-sized avatar
:shipit:
if it compiles it ships

jxu

:shipit:
if it compiles it ships
  • Wit's End
View GitHub Profile
@jxu
jxu / password.py
Created September 13, 2019 22:17
simple password generator
import string, random
pool = string.ascii_letters + string.digits
print(''.join(random.choices(pool, k=16)))
#!/bin/bash
# Executing grep every time is a little slow, but bash regex doesn't support
# lazy evaluation and it's not worth rewriting...
IFS='' # Preserve whitespace for read
while read p; do # Read /boot/grub/grub.cfg line by line
LINE_REGEX=`echo $p | grep -Po "menuentry ['\"]\K.+?(?=['\"])"`
if [ "$LINE_REGEX" ]; then
# Submenu lines begin with a tab, so lazy method is to check for that
@jxu
jxu / pkg-list.sh
Created October 18, 2019 21:40
list packages and size
dpkg-query -W --showformat='${Installed-Size} ${Package}\n' | sort -nr
@jxu
jxu / rc.local
Created October 18, 2019 21:42
from old chromebook?
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
echo "$1" | tr '\!-~' 'P-~\!-O'
@jxu
jxu / term-colors
Created October 18, 2019 21:47
wip
#!/bin/bash
# See full range of terminal colors
for C in {0..255}; do
tput setab $C
printf "%4d" "$C"
if ((C%16 == 15)); then echo; fi
done
tput sgr0
\[FormalA]
\[FormalB]
\[FormalC]
\[FormalD]
\[FormalE]
\[FormalF]
\[FormalG]
\[FormalH]
\[FormalI]
\[FormalJ]
@jxu
jxu / ublacklist.txt
Created July 8, 2020 19:53
C/C++ google search blocklist of low quality sites, for use with uBlacklist
*://www.tutorialspoint.com/*
*://www.geeksforgeeks.org/*
*://www.w3schools.com/*
*://www.programiz.com/*
*://www.techonthenet.com/*
*://fresh2refresh.com/*
*://www.quora.com/*
*://www.researchgate.net/*
*://www.w3resource.com/*
*://www.improgrammer.net/*
@jxu
jxu / control.lua
Last active January 8, 2023 23:53 — forked from Bilka2/control.lua
Create a timelapse from a factorio replay save file
-- Just add this to the end of the control.lua file in the save file and then replay the file
script.on_nth_tick(1800, function(event)
game.take_screenshot{
surface = game.surfaces[1],
position = {0,0},
resolution = {3840,2160},
zoom = 0.2,
path = "timelapse/" .. string.format("%06d", event.tick/event.nth_tick) .. ".jpg",
quality = 95,
@jxu
jxu / download_panopto.sh
Last active August 17, 2022 05:27
Download panopto videos from podcast file (from https://github.com/jstrieb/panopto-download/issues/3)
# requires xq with --raw output support (https://github.com/boyska/xq fork)
xq -r '//item/enclosure/@url' Podcast.ashx | wget -i -