Skip to content

Instantly share code, notes, and snippets.

Brian Onn brianonn

Block or report user

Report or block brianonn

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@brianonn
brianonn / smpte test
Last active Jun 30, 2019
make a SMPTE color test pattern
View smpte test
pulsesink for Pulseaudio output
alsasink for ALSA output
osssink and oss4sink for OSS/OSSv4 output
jackaudiosink for JACK output
View Untitled-1
gst-launch-1.0 videotestsrc ! videoconvert ! autovideosink
@brianonn
brianonn / :home:brian:t.sh
Last active Jul 4, 2019
Create an OSX Mojave ISO from the downloaded (full install) Install Mojave.app
View :home:brian:t.sh
#!/usr/bin/env bash
BuildTmpDir="$HOME/tmp"
hdiutil info | \
awk target="${BuildTmpDir}/MojaveBase.cdr.dmg" '
/image-path/ {
path=$3$4$5$6$7$8$9
start=1
next
@brianonn
brianonn / ci_detect.awk
Created Jun 10, 2019
awk script to detect the CI/CD environment
View ci_detect.awk
#!/usr/bin/awk -f
function usage() {
print "Usage: ci_detect [ detect | get envvar | dump ]"
exit -1
}
function dumpargs() {
printf "ARGC = %d\n", ARGC
for (i = 0; i < ARGC ; ++i) {
@brianonn
brianonn / 00_timestables_test.txt
Last active Jun 10, 2019
test print out times tables in golang and erlang
View 00_timestables_test.txt
00_timestables_test
This is a test gist to try out times tables in golang and erlang
@brianonn
brianonn / entropy.py
Created May 5, 2019
Calculates the Shannon entropy of a string
View entropy.py
import math
def entropy(string):
"Calculates the Shannon entropy of a string"
# get probability of chars in string
prob = [ float(string.count(c)) / len(string) for c in dict.fromkeys(list(string)) ]
# calculate the entropy
entropy = - sum([ p * math.log(p) / math.log(2.0) for p in prob ])
@brianonn
brianonn / cf-nop-worker.js
Created Apr 25, 2019
NOP Cloudflare Worker
View cf-nop-worker.js
addEventListener('fetch', event => {
event.respondWith(bulkRedirects(event.request));
});
async function bulkRedirects(request) {
// this does nothing but return what you asked for
return fetch(request);
}
View new_git_repo.md
touch README.md
git init
git add README.md
git commit -m "first commit"

## push to remote
# the remote repository must already exist 
git remote add origin https://github.com/brianonn/newrepo.git
git push -u origin master
@brianonn
brianonn / Vagrantfile
Created Nov 4, 2018
vagrant with ansible
View Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/xenial64"
config.vm.provider "virtualbox" do |vb|
vb.customize ["modifyvm", :id, "--cpus", "1"]
vb.customize ["modifyvm", :id, "--memory", "768"]
vb.name = "novoansible"
@brianonn
brianonn / create_eth_wallet.py
Last active Oct 30, 2018
make an ethereum address
View create_eth_wallet.py
#!/usr/bin/env python3
import os
import gnupg
from pywallet import wallet
# OS X hack fixed in a newer release of gnupg
gnupg._parsers.Verify.TRUST_LEVELS["ENCRYPTION_COMPLIANCE_MODE"] = 23
seed=wallet.generate_mnemonic()
You can’t perform that action at this time.