Skip to content

Instantly share code, notes, and snippets.

View Spaceghost's full-sized avatar
👻
Building distributed and decentralized systems that run in the browser

Johnneylee Jack Rollins Spaceghost

👻
Building distributed and decentralized systems that run in the browser
View GitHub Profile
@Spaceghost
Spaceghost / build.zig
Created September 18, 2024 19:50 — forked from seatedro/build.zig
static ffmpeg zig build
const std = @import("std");
const builtin = @import("builtin");
pub fn build(b: *std.Build) !void {
const av = b.option(bool, "av", "Compile ffmpeg") orelse false;
const optimize = b.standardOptimizeOption(.{ .preferred_optimize_mode = .ReleaseFast });
const dep_stb = b.dependency("stb", .{});
const dep_ffmpeg = b.dependency("ffmpeg", .{});
// Add a new step for compiling Ffmpeg
@Spaceghost
Spaceghost / compress_video
Created August 22, 2024 19:07 — forked from trvswgnr/compress_video
portable shell script to compress videos with ffmpeg
#!/bin/sh
print_usage() {
echo "usage: compress_video <input_file>"
echo "supported formats: mp4, webm, mkv, mov, avi, flv"
}
get_extension() {
f="${1##*/}"
case "$f" in
begin
require "bundler/inline"
rescue LoadError => e
$stderr.puts "Bundler version 1.10 or later is required. Please update your Bundler"
raise e
end
gemfile(true) do
source "https://rubygems.org"
@Spaceghost
Spaceghost / netboot.sh
Created August 4, 2021 08:48
One-shot to netboot.xyz
wget -c "https://boot.netboot.xyz/ipxe/netboot.xyz.lkrn" -O /boot/netboot.xyz.lkrn && \
cat > /etc/grub.d/40_custom <<EOF
#!/bin/sh
exec tail -n +3 \$0
menuentry 'netboot.xyz' {
set root='hd0,msdos1'
linux16 /netboot.xyz.lkrn
}
EOF
update-grub
@Spaceghost
Spaceghost / mirror_test.sh
Created January 14, 2021 07:54 — forked from lox/mirror_test.sh
A bash script to select the fastest ubuntu apt geo-mirror
#!/bin/bash -e
# mirror_test.sh
# benchmarks closest ubuntu mirrors and outputs them in speed order
# bash -c "$(curl -fsSL https://gist.githubusercontent.com/lox/9152137/raw/mirror_test.sh)"
RELEASE=$(lsb_release -c -s 2>/dev/null || echo 14.04)
MIRRORS=$(curl -s http://mirrors.ubuntu.com/mirrors.txt)
TESTFILE="dists/$RELEASE/main/binary-amd64/Packages.bz2"
TIMEOUT=1
@Spaceghost
Spaceghost / smux.sh
Created October 3, 2020 04:01
autossh combined with tmux for a mosh like behaior
function smux {
AUTOSSH_POLL=10
AUTOSSH_PORT=$(awk 'BEGIN { srand(); do r = rand()*32000; while ( r < 20000 ); printf("%d\n",r) }' < /dev/null)
#AUTOSSH_GATETIME=30
#AUTOSSH_LOGFILE=autossh.$HOST.log
#AUTOSSH_DEBUG=yes
#AUTOSSH_PATH=/usr/local/bin/ssh
export AUTOSSH_POLL AUTOSSH_LOGFILE AUTOSSH_DEBUG AUTOSSH_PATH AUTOSSH_GATETIME AUTOSSH_PORT
@Spaceghost
Spaceghost / how to install entware on ARM.md
Last active August 29, 2015 14:26 — forked from dreamcat4/how to install entware on ARM.md
Install entware on ARM based router eg tomato / ddwrt / asus-merlin cfw
module Prelaunchr
module Twilio
class Client
def self.configure(&block)
Twilio.configure(&block)
end
def initialize
@client = Twilio::REST::Client.new
@Spaceghost
Spaceghost / functions.sh
Created January 20, 2015 04:03
Idempotence in your path.
idempotent_path_prepend() { # idempotent_path_append dir1 dir2 dir3 => dir1:dir2:dir3:$PATH
for ((i=$#; i>0; i--)); do ARG=${!i}
if [ -d "$ARG" ]; then # Only add to path if the path currently exists. Might remove.
PATH=${PATH//":$ARG"/} # delete any instances in the middle or at the end
PATH=${PATH//"$ARG:"/} # delete any instances at the beginning
export PATH="$ARG:$PATH" # prepend to beginning
fi
done
}
@Spaceghost
Spaceghost / gist:bd4a3ec584add69b99da
Created January 10, 2015 02:28
github.com host key fingerprint art
+--[ RSA 2048]----+
| . |
| + . |
| . B . |
| o * + |
| X * S |
| + O o . . |
| . E . o |
| . . o |
| . . |