Skip to content

Instantly share code, notes, and snippets.

View LastZactionHero's full-sized avatar

Zach LastZactionHero

View GitHub Profile
@LastZactionHero
LastZactionHero / buffered_uart.c
Created February 11, 2019 04:35
Buffered Uart TX
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
pthread_mutex_t tx_queue_lock;
typedef struct buffered_tx {
char *string;
int tx_posn;
@LastZactionHero
LastZactionHero / vivado_teardown.rb
Created January 23, 2019 18:40
Vivado VNC Server Teardown
# Saving some money!
# Snapshots the Vivado VNC server and terminates it with the Vultr API
#
# Configuration:
# ENV vultr_api_key
# Server Label: 'vivado'
require 'rest-client'
require 'json'
require 'pry'
@LastZactionHero
LastZactionHero / microblaze_uart.c
Created October 1, 2018 04:00
Microblaze UART
#include <xuartlite_l.h>
#include <xintc_l.h>
/* uartlite interrupt service routine */
void uart_int_handler(void *baseaddr_p) {
char c;
/* till uart FIFOs are empty */
while (!XUartLite_IsReceiveEmpty(XPAR_AXI_UARTLITE_0_BASEADDR)) {
/* read a character */
c = XUartLite_RecvByte(XPAR_AXI_UARTLITE_0_BASEADDR);
@LastZactionHero
LastZactionHero / convert.sh
Created August 1, 2018 21:01
ImageMagick Covert and Color
# Convert to smaller, monochrome
convert source.jpg -monochrome -resize 320x240 output.jpg
# Convert to gray samples
convert output.jpg gray:output.gray
# Convert back from monchrome samples to jpg (unnecessary)
convert -size 320x240 -depth 8 output.gray rebuild.jpg
# Convert monchrome JPG to RGB colorspace
convert rebuild.jpg -colorspace sRGB -type truecolor rebuild.jpg
@LastZactionHero
LastZactionHero / Boulder Tubing.md
Last active July 6, 2018 20:57
Boulder Tubing Assignment

Boulder Tubing Guide

During the summer, people go tubing down Boulder Creek. To be fun, it has to be just right: enough water flowing, hot enough, and mostly sunny.

Objective: Build an application that lets the user know if it's a good day to go tubing. Implement it however you'd like using. Preferably Ruby on Rails for the backend/API, but beyond that whatever stack you feel is appropriate.

The goal is to demonstrate general competency, and comfort developing an open-ended application. Take about an hour. Since that's not much time, it's fine to describe unfinished parts with what you'd have liked to do.

function crossed_boundary(current_posn, next_position, direction, segments)
function find_boundaries_crossed(z, segments, min, direction)
boundaries_crossed = 0
current_posn = min - 1.5 * DELTA
bool checking = true
while(checking)
next_posn = current_posn + 1
@LastZactionHero
LastZactionHero / cheatsheet.v
Last active January 30, 2024 15:11
Verilog Syntax Cheat Sheet
module module_name(signal_a, signal_b);
input [7:0] signal_a;
output signal_b;
endmodule
parameter n = 32;
integer k;
for (k = 0; k < n; k + 1)
begin
@LastZactionHero
LastZactionHero / pre-commit.sh
Created January 15, 2018 23:00
Git Pre-Commit Prohibit Debugging Commands
#!/bin/sh
#
# Check to make sure we're not trying to commit debugging code
COMMIT_OK=true
# Find all staged files with appropriate file types (Ruby, Javascript, Vue)
STAGED_MATCHING_FILENAMES=$(git diff --cached --name-only | grep -E '\.js$|.vue|.rb$')
# Loop over all of the files
@LastZactionHero
LastZactionHero / blade_setup.sh
Last active March 4, 2018 17:23
Linux on Razer Blad
#!/bin/sh
case $1 in
post)
rmmod i2c_hid
modprobe i2c_hid
;;
esac
set macligatures
set guifont=Fira\ Code:h12
highlight ColorColumn ctermbg=magenta
call matchadd('ColorColumn', '\%81v', 120)