Skip to content

Instantly share code, notes, and snippets.

# ~/.zshrc - Cade Brown's ZSH and general settings
#
#
# ZSH things
#
# Themes:
# * https://github.com/sindresorhus/pure
# * https://github.com/romkatv/powerlevel10k
#
# Plugins:
@cadebrown
cadebrown / .p10k.zsh
Created January 31, 2022 05:25
My powerlevel10k config
# put this as ~/.p10k.zsh for powerlevel10k
# Generated by Powerlevel10k configuration wizard on 2022-01-20 at 15:26 EST.
# Based on romkatv/powerlevel10k/config/p10k-rainbow.zsh, checksum 53041.
# Wizard options: nerdfont-complete + powerline, large icons, rainbow, unicode,
# 24h time, angled separators, sharp heads, flat tails, 2 lines, solid, left frame,
# light-ornaments, sparse, few icons, concise, instant_prompt=verbose.
# Type `p10k configure` to generate another config.
#
# Config for Powerlevel10k with powerline prompt style with colorful background.
@cadebrown
cadebrown / install-rife.sh
Last active November 13, 2021 20:54
install RIFE video upscaler
URL_MODEL="https://drive.google.com/file/d/1APIzVeI-4ZZCEuIRE1m6WYfSCaOsi_7_/view"
# clone and setup repo
git clone https://github.com/hzwer/arXiv2020-RIFE
cd arXiv2020-RIFE
pip3 install numpy tqdm sk-video torch torchvision opencv-python moviepy
# now, try to open the model URL to download... if this doesn't work, manually visit 'URL_MODEL' and unzip it
xdg-open "$URL_MODEL"
@cadebrown
cadebrown / colab_forever.js
Created November 7, 2021 16:57
Colab Forever (from Randy Brown)
// AUTHOR: Randy Brown <github.com/randbrown>
// open dev tools and run this in the console to prevent the 90 minute timeout
function ClickConnect() {
console.log("Working");
document
.querySelector('#top-toolbar > colab-connect-button')
.shadowRoot.querySelector('#connect')
.click()
}
@cadebrown
cadebrown / images2video.sh
Last active February 28, 2022 17:01
use GPU acceleration with FFMPEG
# run this to turn frames into video, using a NVIDIA GPU
ffmpeg -y -vsync 0 -hwaccel cuda -hwaccel_output_format cuda -r 30 \
-i 'frame_%05d.png' -c:a copy -c:v h264_nvenc -b:v 50M \
output.mp4
# CPU
ffmpeg -y -vsync 0 -r 30 \
-i 'frame_%05d.png' -c:a copy -c:v h265 -b:v 50M \
output.mp4
@cadebrown
cadebrown / mg.c
Last active October 6, 2021 03:10
mg (my-grep), an open-source, single-file implementation of regex & grep-like functionality from scratch
/* mg.c - my-grep implementation, portable regex and search implementation in pure C
*
* should build on UNIX/Linux-like OSes no problem, should also work on Windows Subsystem for Linux (WSL)
*
* regex syntax: read the second comment block in this file
*
* compile like:
* $ cc mg.c -o mg
*
* then you can run like:
@cadebrown
cadebrown / gen_gz.py
Created October 12, 2020 03:11
Gamma/Zeta function table generator for my personal blog
#!/usr/bin/env python3
""" tools/gen_gz.py - generate C code to compute Gamma and Zeta functions for real and complex values
Example:
$ ./tools/gen_gz.py --lgamma > src/modules/m/gz.c
Originally developed for kscript's `m` library to supplement the C99 math library; it is free to use this script to generate
code for any non-commercial uses. For any commercial uses, please contact the @author below
References:
@cadebrown
cadebrown / benchmark_mine.txt
Created August 6, 2020 19:12
Testing out my generated code for the Gamma and Zeta functions. Code generated from https://github.com/ChemicalDevelopment/kscript/blob/master/modules/m/tools/table_zeta.py, check my blog for more info: http://cade.site/Implementing-Zeta-Gamma/
$ gcc -std=c99 -Ofast -fno-math-errno t.c -lm -o test_gz && ./test_gz
# -- ACCURACY
|my_gamma(x)-tgamma(x)| <= 0.000000 , at x=0.000480, accurate to 14.76 digits
# -- SPEED
my_gamma(x), x in [0, 1) : 0.039 us/iter
my_gamma(x), x in [0, 4) : 0.038 us/iter
my_gamma(x), x in [0, 16) : 0.037 us/iter
my_gamma(x), x in [0, 256) : 0.052 us/iter
my_cgamma(x), x in [0i, 1i) : 0.137 us/iter
@cadebrown
cadebrown / install-opencv.sh
Created January 27, 2017 22:40
Code to install OpenCV
#!/bin/bash
sudo apt-get install build-essential cmake pkg-config
sudo apt-get install libjpeg8-dev libtiff5-dev libjasper-dev libpng12-dev
sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev
sudo apt-get install libxvidcore-dev libx264-dev
sudo apt-get install libgtk-3-dev
sudo apt-get install libatlas-base-dev gfortran
sudo apt-get install python2.7-dev python3.5-dev

Keybase proof

I hereby claim:

  • I am cadebrown on github.
  • I am cadebrown (https://keybase.io/cadebrown) on keybase.
  • I have a public key ASCRZd8CbvgL9QNcfLaFtuBY8pXaKfEuOLdUSO4J6Wxjgwo

To claim this, I am signing this object: