Skip to content

Instantly share code, notes, and snippets.

View dvtate's full-sized avatar
🐧
chilling

Dustin Van Tate Testa dvtate

🐧
chilling
View GitHub Profile
@dvtate
dvtate / challenge.cpp
Created February 1, 2017 04:07
the solution to the challenge faced by my friend Umar Faroq
#include <stdio.h>
#include <stdlib.h>
int main(){
// prompt:
printf("please enter a string:");
// get input
size_t linelen = 500;
#include <iostream>
#include <string.h>
int main(int argc, char* args[]){
if (strcmp(args[1], "--version") == 0) {
std::cout <<"This is a ghetto echo function that reads in reverse.\n";
return 0;
} else if (strcmp(args[1], "--help") == 0) {
std::cout <<"Useage: echo [OPTION]... [STRING]...\n"
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
#include <signal.h>
unsigned long long int numLaughs = 0;
void normalExit(void){
printf("\nI laughed %llu times、\n\n", numLaughs);
@dvtate
dvtate / HexToRGB.cpp
Last active November 7, 2016 06:43
converts a string representing a hex number into 8-bit RGB values
#include <iostream>
#include <stdint.h>
#include <string.h>
// this solution is dependent on endianess, and is thus not cross-platform
struct RGB_t {
#include <iostream>
#pragma pack(0)
// a 4-bit bitfield
struct word_t {
unsigned int val : 4;
};
// 8-bits
@dvtate
dvtate / terminal_colors_test.cpp
Last active March 31, 2017 06:30
a simple test of ansi color codes for modern terminal emulators
#include <stdio.h>
#include <inttypes.h>
#include <stdarg.h>
#define COLOR_RESET "\x1B[0m"
inline void textColor()
import tkinter as tk;
import random;
class Application(tk.Frame):
def __init__(self, master = None):
tk.Frame.__init__(self, master);
self.grid();
self.createWidgets();
@dvtate
dvtate / lamp.pov
Last active July 6, 2016 20:06
a lamp on a tiled floor in a dark environment
#version 3.7
global_settings{ assumed_gamma 1.0 }
#default{ finish{ ambient 0.1 diffuse 0.9 }}
#include "colors.inc"
#include "glass.inc"
/*
light_source {
<50, 20, 10>
color White
@dvtate
dvtate / snake.py
Last active October 12, 2016 03:45
follows the mouse..
import tkinter as tk;
import random;
import time;
WIDTH = HEIGHT = 800;
POPULATION = 200;
# returns a hex color between #000 and #FFF in the form of a string
@dvtate
dvtate / game_timer.ino
Last active March 31, 2017 06:32
a game timer/buzzer I made for GHP engineering's saturday build challenge.
#include "Arduino.h"
#include <inttypes.h>
#define BUTTON_PIN 4
#define BUZZ_PIN 5
#define RED_LED_PIN 8
#define GREEN_LED_PIN 9