Skip to content

Instantly share code, notes, and snippets.

View main.cpp
#include <iostream>
#include <fstream>
#include <GL/glew.h>
#include <GLFW/glfw3.h>
#include <glm/gtc/matrix_transform.hpp>
#include "window.h"
#include "shaders.h"
@viperscape
viperscape / font.c
Created Apr 14, 2018
bmfont rendering with sdl
View font.c
#include "font.h"
#include "../SDL/SDL.h"
#include <stdio.h>
#include <string.h>
struct font font_init (SDL_Renderer* renderer, char *filename) {
char filename_[256] = {'\0'};
strcat(filename_, filename);
strcat(filename_, ".fnt");
View conda.sh
node ./condapiler/condapiler.js $1
@viperscape
viperscape / build.sh
Last active Apr 5, 2018
random hex string from sqlite3's CSRNG
View build.sh
gcc -g -Wall -O1 sqlite3/sqlite3.c main.c -o randid
@viperscape
viperscape / thread.h
Last active Mar 6, 2018
cross os threading example
View thread.h
void* thread (void* (callback)(void* data), void* data);
void join (void* p);
#ifdef _WIN32
#include <windows.h>
void* thread (void* (callback)(void* data), void* data) {
HANDLE p = CreateThread(NULL, 0, callback, data, 0, NULL);
return p;
}
@viperscape
viperscape / client.c
Last active Mar 5, 2018
cross os socket example
View client.c
#include "socket.h"
// win32
// -lws2_32
int main() {
void* sock = socket_bind("127.0.0.1", 6063, 1);
socket_free(sock);
return 0;
View keybase.md

Keybase proof

I hereby claim:

  • I am viperscape on github.
  • I am chrisfgill (https://keybase.io/chrisfgill) on keybase.
  • I have a public key ASBVuPQh5ZML0_sWjPLvTX5sbIoFLffjbH-jZk--aV8GMgo

To claim this, I am signing this object:

@viperscape
viperscape / core.clj
Created Sep 3, 2014
async chans and kuroshio streams
View core.clj
(ns chan-test.core
(:gen-class)
(:require [clojure.core.async :as async]
[kuroshio.core :as k]))
(defn create-string []
(apply str (take 10000 (repeat ".\r\n"))))
(defn println-err [& args]
(binding [*out* *err*]
@viperscape
viperscape / init.el
Created Sep 27, 2016
solarized-toggler
View init.el
(set 'nitemode nil)
(defun toggle-nitemode ()
"toggles nitemode"
(interactive)
(cond ((not nitemode)
(load-theme 'solarized-dark t)
(set 'nitemode 1))
((eq 1 nitemode)
(load-theme 'solarized-light t)
(set 'nitemode nil))))
@viperscape
viperscape / ec2-power.py
Last active Jun 8, 2016
script to power on/off ec2 instances based on block times, reassociates eip if needed and saves cache of eips when rerun
View ec2-power.py
import boto.ec2
import sys
import datetime
from time import gmtime, strftime, sleep
import toml
# expects ec2 instance tag: power-off
# values should be in 24hr clock from:to
# eg 2400:0400
# would result in midnight to 4am
You can’t perform that action at this time.