Skip to content

Instantly share code, notes, and snippets.

View wasv's full-sized avatar
🏳️‍🌈

Bailey wasv

🏳️‍🌈
View GitHub Profile
@wasv
wasv / flake.nix
Created May 15, 2026 00:35
Nix package build and dev shell for programs using winit
{
description = "a rust project";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
fenix = {
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs";
@wasv
wasv / rec.sh
Created May 19, 2017 00:13
Example command for recording from an somagic easycap video grabber
sudo somagic-capture -n -s | ffmpeg -f rawvideo -video_size 720x480 -framerate 29.97 -vcodec rawvideo -pix_fmt uyvy422 -itsoffset 00:00:01.5 -i - -f pulse -ac 2 -i default `cat /proc/sys/kernel/random/uuid`.avi
@wasv
wasv / headless-opengl.txt
Created January 22, 2017 19:26
OpenGL with no Monitors
How to setup an OpenGL X11 Session without a monitor connected. Useful for servers with a graphics card, but no monitors.
/etc/X11/xorg.conf.d/10-monitor.conf
Section "Monitor"
Identifier "Monitor0"
HorizSync 5.0 - 1000.0
VertRefresh 5.0 - 200.0
Modeline "1600x1200" 22.04 1600 1632 1712 1744 1200 1229 1231 1261
EndSection
@wasv
wasv / start.sh
Created May 21, 2016 18:16
A script for starting a python app in a virtualenv.
#!/bin/bash
NAME=>>YOUR_APP<<
BASE_DIR=>>YOUR_HOMEDIR<<
RUN_DIR=$BASE_DIR/>>YOUR_PROJECT<<
VENV_DIR=$BASE_DIR/>>YOUR_VENV<<
DAEMON=python
DAEMON_OPTS=$BASE_DIR/>>YOUR-SCRIPT<<
echo "Starting server" $NAME
cd $RUN_DIR
/*
* Creates Tables for Volunteer database.
*/
USE Volunteers;
DROP TABLE IF EXISTS Users;
CREATE TABLE Users(
user_id INT NOT NULL AUTO_INCREMENT,
user_name VARCHAR(64),
user_last_picked DATE,
@wasv
wasv / Timelapse.sh
Created January 27, 2015 18:21
A simple timelapse script for fswebcam.
#!/bin/bash
while true; do
fswebcam -S 120 -r 800x600 --save `date +%d_%H%m%S`.jpg # take photo, filename is day_time
for i in {600..1}; do echo $i; sleep 1; done # 600s countdown timer
done
@wasv
wasv / Circle.java
Created October 15, 2014 17:54
Programming Assignment 2
public class Circle { // Class
private double radius; // Variable
private static final double PI = 3.14159; // Constant
public Circle() { radius = 0.0; } // Constructor
public Circle(double radius) { this.radius = radius; } // Constructor with Parameter
// Methods
public double getRadius() { return radius; }
@wasv
wasv / pathfinding.py
Created September 28, 2014 15:02
Pathfinding Script that reads a black and white png, then outputs a png with the path traced on it. (requires numpy, PIL, PyPNG)
from Queue import PriorityQueue
import numpy as np
from PIL import Image
import png
im = Image.open('./floormap-crop.png')
#print np.array(im)
print "---"
im = im.convert('L')
im_map = np.array(im)
@wasv
wasv / pathfinding.py
Created September 28, 2014 02:56
Pathfinding Script that Reads from Numpy Array
from Queue import Queue
import numpy as np
from PIL import Image
im = Image.open('./map.png')
im.convert('L')
im_map = np.array(im)
#print im_map
all_nodes = []
@wasv
wasv / pathfinding.py
Created September 28, 2014 00:13
Simple Python Pathfinding Script
# Mostly based on http://www.redblobgames.com/pathfinding/a-star/introduction.html
# Except made functional and put all in one place.
from Queue import Queue
all_nodes = []
bad_nodes = [(0,0),(9,0),(0,10),(1,10),(2,10),(3,10),(4,10),(5,10),(0,19),(9,19)]
start_node = (1,0)
end_node = (0,18)
for y in range(20):