Skip to content

Instantly share code, notes, and snippets.

View randName's full-sized avatar
🔞
nsfw (the OSHA kind)

Shun Git randName

🔞
nsfw (the OSHA kind)
View GitHub Profile
@randName
randName / voltage_divider.py
Last active January 15, 2019 06:35
Gets the best resistors in the E12 series to use for a particular voltage drop desired
E12 = (1.0, 1.2, 1.5, 1.8, 2.2, 2.7, 3.3, 3.9, 4.7, 5.6, 6.8, 8.2)
ROS = tuple((x / y, (x, y)) for x in E12 for y in E12)
def estimator(inv, ouv):
ratio = (inv - ouv) / ouv
for r, v in ROS:
abserr = abs(r - ratio)
relerr = abserr / ratio
yield (relerr, abserr, v)
@randName
randName / FCD.py
Created June 6, 2014 15:06
Fast Circle Detection using Gradient Pair Vectors
#!/usr/bin/env python2
import numpy as np
import cv2 as cv
def FCD( src, mask ):
A_THRESH = [ 2, 1 ]
sobel_x = cv.Sobel( src, cv.CV_32F, 1, 0, ksize = 5 )
@randName
randName / kogge-stone.py
Last active December 18, 2018 12:32
Generates Kogge-Stone Full Adder for SAT CNF Format
fulladder = """aS{0}:=ODD(A{0},B{0},C{1});
C{0}:=OR(AND(A{0},B{0}),AND(C{1},ODD(A{0},B{0})));"""
def koggestone(i, l, maxi):
g = "G{2}{1}:=OR(G{3}{1},AND(P{3}{1},{4}));"
p = "\nP{2}{1}:=AND(P{3}{1},P{3}{0});"
i -= 1
s = 2 ** l
if i + s >= maxi:
return ""
@randName
randName / DW_Guide.md
Last active October 7, 2019 10:43
Guide to the Digital World Midterm

Guide to the Digital World Midterm

Last updated: 07/10/2019

Your feedback will be much appreciated, so either leave a comment below or PM @randName on Telegram.

tl;dr - A checklist

  • Do right now:
    • Download the documentation and get used to doing questions with it
  • Do in the meantime:
@randName
randName / SolarizedDark.theme
Last active January 22, 2024 11:25
Solarized Dark Theme for Windows (using High Contrast mode)
[Theme]
DisplayName=Solarized Dark
[Control Panel\Desktop]
PicturePosition=4
[VisualStyles]
Path=
ColorStyle=NormalColor
Size=NormalSize
@randName
randName / ifttt.sh
Created May 25, 2018 14:18
shell script for IFTTT Webhooks
#!/bin/sh
[ -z "$@" ] && echo "Usage: $( basename $0 ) MESSAGE" && exit 1
[ ! -f ~/.ifttt ] && echo "~/.ifttt not found" && exit 1
. ~/.ifttt
[ -z "$IFTTT_KEY" ] && echo "Please set your IFTTT key in ~/.ifttt" && exit 1
@randName
randName / tensorboard_base.ipynb
Last active December 22, 2018 12:32
TensorBoard_Base.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@randName
randName / index.html
Created February 6, 2019 10:33
animatedDog
<html>
<head>
<style>
.buttonInImage {
position: relative;
width: 100%;
max-width: 400px;
margin-left: auto;
margin-right: auto;
}
@randName
randName / template.ipynb
Created April 4, 2019 02:03
Colaboratory Template
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Keybase proof

I hereby claim:

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

To claim this, I am signing this object: