Skip to content

Instantly share code, notes, and snippets.

@candh
candh / guide.md
Last active November 20, 2022 10:44
Hacker's guide to Writing
@candh
candh / optim.py
Last active March 20, 2020 16:19
from my cs231n solution
import numpy as np
"""
This file implements various first-order update rules that are commonly used
for training neural networks. Each update rule accepts current weights and the
gradient of the loss with respect to those weights and produces the next set of
weights. Each update rule has the same interface:
def update(w, dw, config=None):

Keybase proof

I hereby claim:

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

To claim this, I am signing this object:

# create a new simulator object
set ns [new Simulator]
# define different colors for data flows
# as defined by fid_
$ns color 1 Blue
$ns color 2 Red
$ns color 3 Green
$ns color 4 Black
@candh
candh / ass4.asm
Created December 1, 2019 14:08
find largest number in assembly
.stack 100h
.model small
.data
arr dw 12, 25, 7, 44
N dw 4
MAXN dw 0
msg1 db "Max = $"
.code
main proc
mov ax, @data
@candh
candh / node-creation.tcl
Created November 23, 2019 17:59
[DCCN] 1st lab NS2
#Create a simulator object
set ns [new Simulator]
#Open the NAM trace file
set nf [open out.nam w]
$ns namtrace-all $nf
# Define finish procedure
proc finish {} {
global ns nf
@candh
candh / data.sql
Created April 28, 2019 12:22
w3resources is dumb
INSERT INTO reviewer (rev_id, rev_name) VALUES(9001, 'Righty Sock')
INSERT INTO reviewer (rev_id, rev_name) VALUES(9002, 'Jack Malvern')
INSERT INTO reviewer (rev_id, rev_name) VALUES(9003, 'Flagrant Baronessa')
INSERT INTO reviewer (rev_id, rev_name) VALUES(9004, 'Alec Shaw')
INSERT INTO reviewer (rev_id, rev_name) VALUES(9005, '')
INSERT INTO reviewer (rev_id, rev_name) VALUES(9006, 'Victor Woeltjen')
INSERT INTO reviewer (rev_id, rev_name) VALUES(9007, 'Simon Wright')
INSERT INTO reviewer (rev_id, rev_name) VALUES(9008, 'Neal Wruck')
INSERT INTO reviewer (rev_id, rev_name) VALUES(9009, 'Paul Monks')
INSERT INTO reviewer (rev_id, rev_name) VALUES(9010, 'Mike Salvati')
@candh
candh / opengl.c
Last active February 18, 2019 14:16
opengl.c template for mac, linux and windows.
#ifdef __APPLE__
#define GL_SILENCE_DEPRECATION
#include <GLUT/glut.h>
#else
#ifdef _WIN32
#include <window.h>
#endif
// linux and win
#include <GL/glut.h>
#endif
@candh
candh / CMakeLists.txt
Created February 9, 2019 22:11
CMakeList for OpenGL. Tested on macOS only. Seems Finicky
cmake_minimum_required(VERSION 3.6)
project(Testing C)
find_package(OpenGL REQUIRED)
find_package(GLUT REQUIRED)
if (OPENGL_FOUND)
message("opengl found")
message("include dir: ${OPENGL_INCLUDE_DIR}")
message("link libraries: ${OPENGL_gl_LIBRARY}")
@candh
candh / makefile
Last active February 27, 2019 16:04
makefile for OpenGL projects in C for both Mac and Linux (Works with gcc versions >= 5.5 on linux. Tested on Ubuntu)
# candh
# set compiler
CC = gcc
MACFLAGS = -framework OpenGL -framework GLUT
LINFLAGS = -lGL -lGLU -lglut
TARGET = main
mac: