Skip to content

Instantly share code, notes, and snippets.

View chetbox's full-sized avatar
🤖
Making da codez

Chetan Padia chetbox

🤖
Making da codez
View GitHub Profile
@chetbox
chetbox / launch-qemu-rpi-3.sh
Last active November 16, 2024 20:18
Run Raspberry Pi 64 system image with QEMU on macOS
#!/bin/bash
# Requirements:
# - macOS
# - qemu - `brew install qemu`
# - A raw 64-bit Raspberry Pi system image to boot (Usually a .img)
set -e
if [[ -z "$1" ]]; then
@chetbox
chetbox / 50-fbtft.conf
Last active February 18, 2023 20:26
Waveshare 1.5" OLED screen Raspberry Pi config
# FBTFT xorg config file
# Assumes you don't have an HDMI screen connected (which would usually be /dev/fb0)
Section "ServerLayout"
Identifier "TFT"
Option "BlankTime" "10"
Screen 0 "ScreenTFT"
EndSection
Section "Screen"
@chetbox
chetbox / audioswitcher.html
Last active May 11, 2022 10:08
Browser audio output switching
<!DOCTYPE html>
<html>
<body>
<button>
Play/pause
</button>
<script>
const audioElement = document.createElement('audio');
audioElement.src = 'http://www.jamesreams.com/wp-content/uploads/2013/01/30-Sec-Acre.mp3';
#!/bin/bash
function compile {
echo "$1" > tmp.ts
node_modules/.bin/tsc --noEmit --diagnostics tmp.ts
echo ""
}
echo "Empty file"
compile ""
@chetbox
chetbox / git-branch-list_install.sh
Last active May 12, 2020 09:10
git list-branch: List local git branches, ordered by last commit
git config --global alias.branch-list "for-each-ref --sort='-committerdate' --format='%(color:dim white)%(committerdate:relative)%(color:normal)%09%(color:no-dim magenta)%(refname:short) %(color:no-dim red)%(upstream:short)' refs/heads"
git branch-list
@chetbox
chetbox / quicksync.md
Created February 17, 2020 13:42
Intel QuickSync hardware accelerated video encode/decode (mirror of FFMpeg list)
Platform Name Graphics Adds support for...
Ironlake gen5 MPEG-2, H.264 decode.
Sandy Bridge gen6 VC-1 decode; H.264 encode.
Ivy Bridge gen7 JPEG decode; MPEG-2 encode.
Bay Trail gen7 -
Haswell gen7.5 -
Broadwell gen8 VP8 decode.
Braswell gen8 H.265 decode; JPEG, VP8 encode.
Skylake gen9 H.265 encode.
@chetbox
chetbox / node_rsa_asymmetric_encryption.js
Last active August 6, 2019 13:46
RSA asymmetric data encrypt and decrypt in Node JS
const { generateKeyPairSync, publicEncrypt, privateDecrypt } = require('crypto');
const { publicKey, privateKey } = generateKeyPairSync('rsa', {
modulusLength: 4096,
publicKeyEncoding: {
type: 'spki',
format: 'pem',
},
privateKeyEncoding: {
type: 'pkcs8',
format: 'pem'
# Compare packet loss to two destinations
# Works on macOS
(while true ; do
date
ping -c 1 192.168.1.1
date
ping -c 1 1.1.1.1
sleep 1
done) \
@chetbox
chetbox / parallel_curl.sh
Created February 1, 2018 15:58
Run "curl" requests in parallel in a script
PARALLEL_JOBS=4
parallel_curl() {
((i=i%$PARALLEL_JOBS)); ((i++==0)) && wait
curl "$@" &
}
parallel_curl https://url1.com
parallel_curl https://url2.com
parallel_curl https://url3.com