Skip to content

Instantly share code, notes, and snippets.

@wh5a
wh5a / digitalocean
Last active June 7, 2017 15:36
Fixing Digital Ocean network
# With newer systemd, eth0 can get renamed to ens3 or similar.
# Strangely the renaming doesn't always happen, but when it does it breaks Digital Ocean's default setup.
sudo su
pacman -Rsc netcfg ifplugd
systemctl disable netcfg.service
systemctl disable net-auto-wired
systemctl enable systemd-networkd.service
cat > /etc/systemd/network/ens3.network
@wh5a
wh5a / gist:7440969
Last active December 28, 2015 04:18
Running Scala GUI program in a chroot
# Install required libraries and fonts
sudo pacman -S libcups fontconfig libxrender libxtst gtk2 ttf-dejavu
export DISPLAY=:1.0
cd simulations; sbt compile; scala -cp target/scala-2.10/classes simulations.gui.EpidemyDisplay
@wh5a
wh5a / QuickCheck.scala
Created November 10, 2013 05:09
Coursera Reactive Scala Programming #1 - Quickcheck
package quickcheck
import common._
import org.scalacheck._
import Arbitrary._
import Gen._
import Prop._
import Math._
@wh5a
wh5a / resonance_policy.py
Created July 30, 2013 16:34
SDN Module 6 Pyresonance Load Balancer
'''
Coursera:
- Software Defined Networking (SDN) course
-- Module 7 Programming Assignment
Professor: Nick Feamster
Teaching Assistant: Muhammad Shahbaz
'''
################################################################################
@wh5a
wh5a / pyretic_firewall.py
Created July 23, 2013 17:47
SDN Module 6 Pyretic Firewall
'''
Coursera:
- Software Defined Networking (SDN) course
-- Module 6 Programming Assignment
Professor: Nick Feamster
Teaching Assistant: Muhammad Shahbaz
'''
################################################################################
@wh5a
wh5a / firewall.py
Created July 16, 2013 22:52
SDN Module 4 OpenFlow Firewall
'''
Coursera:
- Software Defined Networking (SDN) course
-- Module 4 Programming Assignment
Professor: Nick Feamster
Teaching Assistant: Muhammad Shahbaz
'''
from pox.core import core
@wh5a
wh5a / CustomTopo.py
Created July 8, 2013 20:34
Coursera SDN Module 3
'''
Coursera:
- Software Defined Networking (SDN) course
-- Module 3 Programming Assignment
Professor: Nick Feamster
Teaching Assistant: Muhammad Shahbaz
'''
from mininet.topo import Topo
@wh5a
wh5a / mp6.c
Last active April 5, 2024 08:02
CUDA 2D Convolution.
#include <wb.h>
// Check ec2-174-129-21-232.compute-1.amazonaws.com:8080/mp/6 for more information
#define wbCheck(stmt) do { \
cudaError_t err = stmt; \
if (err != cudaSuccess) { \
wbLog(ERROR, "Failed to run stmt ", #stmt); \
return -1; \
@wh5a
wh5a / mp5.c
Last active April 9, 2021 20:56
CUDA Work Efficient Parallel Scan.
// MP 5 Scan
// Given a list (lst) of length n
// Output its prefix sum = {lst[0], lst[0] + lst[1], lst[0] + lst[1] + ... + lst[n-1]}
// Due Tuesday, January 22, 2013 at 11:59 p.m. PST
#include <wb.h>
#define BLOCK_SIZE 512 //@@ You can change this
#define wbCheck(stmt) do { \
@wh5a
wh5a / mp4.c
Created January 1, 2013 03:05
CUDA Array Sum with Reduction
// MP 4 Reduction
// Given a list (lst) of length n
// Output its sum = lst[0] + lst[1] + ... + lst[n-1];
// Due Tuesday, January 15, 2013 at 11:59 p.m. PST
#include <wb.h>
#define BLOCK_SIZE 512 //@@ You can change this
#define wbCheck(stmt) do { \