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 / pinyintool.cpp
Last active February 1, 2017 04:13
An incomplete pinyin tones tool. (doesn't support combining words)
#include <iostream> //std::cin, std::cout, std::getline(), std::string,
#include <sstream> //std::stringstream
#include <inttypes.h> //fixed width integer types
uint16_t firstVowel(const std::string& word); ///returns index of first vowel
uint8_t getTone(std::string& word); ///returns the tone of the word and removes tone indicator
void convertToPinyin(const uint8_t tone, std::string& word); ///adds accent to vowel
void printWords(std::string* words, const size_t numWords); ///calls all other funcions and prints the pinyin
size_t countSpaces(const std::string& text); // counts the number of spaces in a string
@dvtate
dvtate / timer.cpp
Created February 19, 2016 15:34
A lame/simple timer program that I used as a tutorial. (oddly, works in DOS terminal, but linux is being glitchy for some reason)
#include <iostream> //std::cout
#include <unistd.h> //usleep()
/// prints time and waits 0.25seconds
void printTimeCR( //please excuse my Danish abbreviations
unsigned int dag,
unsigned int t,
unsigned int min,
unsigned int sek,
unsigned int kvSek
@dvtate
dvtate / HotCorner.ahk
Last active December 8, 2023 16:01
Add a hot-corner to access task view in windows 10
;The Problem:
; I love the hotcorner(s) in GNOME & KDE, and kept finding myself
; trying to use them since I've been forced to use windows 10 (winshit).
;My solution:
; download & install: https://autohotkey.com/
; save this script with the extension ".ahk"
; click on the script to start it and/or set it to launch automatically.
#Persistent
@dvtate
dvtate / xmlUtils.c
Last active January 5, 2017 04:22
Some functions I need to make to replace the PHP functions I had used before.
#include <stdio.h>
#include "xml_utils.h"
int main(){
char* testString = "boring... <cool>good stuff here</cool>lame stuff here";
printf("\nThe string is: \"%s\"\n\n", testString);
printf("The cool stuff (with tags) = \"%s\"\n\n",
@dvtate
dvtate / .SRCINFO
Last active March 31, 2016 00:36
PKGBUILD: An arch build system (ABS) script for MarisaHttpd. (this file is incomplete and will not build)
pkgbase = marisahttpd-git
pkgdesc = High-effiency dynamic webpage server and runtime for C/C++
pkgver = 0.4.r35.g45274d1
pkgrel = 1
url = https://github.com/AmamiyaRinyuki/MarisaHttpd
arch = any
license = GPL
makedepends = git
makedepends = libmicrohttpd
provides = marisa
@dvtate
dvtate / nyental.css
Created March 29, 2016 18:12
my main stylesheet for my website ( https://dvtate.com )
/*structure*/
html{font-size:112.5%;}
body{min-width:450px;font-family:sans-serif;
color:#000;margin-left:0px;margin-right:0px;
background-color:#000;background-attachment:fixed;
background-image:url(https://dvtate.com/styles/baggrund.png);
}div.main{background-color:#FFF;padding:2px 20px 5px 10px;margin:0% 5%;}
/*nav-bar*/
a.page:link, a.page:visited{padding:4px;display:block;
text-align:center;color:#FFF;text-decoration:none;
@dvtate
dvtate / sorting.cpp
Last active May 14, 2016 18:27
A lame sorting algorithm
#include <iostream>
template<class T>
void sortArray(T* arr, size_t length){
//for each element of the array...
for (length; length > 0; length--, arr++) {
T maxValue = *arr;
@dvtate
dvtate / strtonum.c
Last active June 4, 2016 22:57
code for converting a string to an int or a double (separate functions)
#include <iostream>
#include <stdlib.h> // malloc()
#include <stdio.h> //puts(), gets(), printf()
#include <string.h> // strlen()
#include <inttypes.h> // fixed width integer types
#include <math.h> // pow()
// the function prototypes
inline int8_t chartonum(const char&);
char* firstDecimal(char*);
replaced by https://github.com/robobibb/trophy
char* findOccurance(char* source, char* query){
char* queryCopy = query;
while ( *source != '\0') {
if (*(source++) == *query) {
query++;
while (*query != '\0' && *source == *query) {
source++;
query++;