Skip to content

Instantly share code, notes, and snippets.

viperscape / xls2sqldb
Created January 29, 2021 19:55
creates a dbo schema based on a spreadsheet's tables
import openpyxl as xl
def get_table(workbook, sheet_name, table_name):
ws = workbook[sheet_name]
g = workbook.defined_names[table_name].destinations
# note we expect python 3.7 ordered dictionaries by default
table = {}
for s,a in g:
for col in ws[a][0]: # get columns
viperscape / main.cpp
Last active November 14, 2018 07:03
gltf 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 / font.c
Created April 14, 2018 17:39
bmfont rendering with sdl
#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");
viperscape /
Last active April 5, 2018 20:39
random hex string from sqlite3's CSRNG
gcc -g -Wall -O1 sqlite3/sqlite3.c main.c -o randid
viperscape / client.c
Last active March 5, 2018 01:50
cross os socket example
#include "socket.h"
// win32
// -lws2_32
int main() {
void* sock = socket_bind("", 6063, 1);
return 0;
viperscape / thread.h
Last active March 6, 2018 19:12
cross os threading example
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 /
Last active April 10, 2018 18:09
node ./condapiler/condapiler.js $1

Keybase proof

I hereby claim:

  • I am viperscape on github.
  • I am chrisfgill ( on keybase.
  • I have a public key ASBVuPQh5ZML0_sWjPLvTX5sbIoFLffjbH-jZk--aV8GMgo

To claim this, I am signing this object:

viperscape / init.el
Created September 27, 2016 17:57
(set 'nitemode nil)
(defun toggle-nitemode ()
"toggles nitemode"
(cond ((not nitemode)
(load-theme 'solarized-dark t)
(set 'nitemode 1))
((eq 1 nitemode)
(load-theme 'solarized-light t)
(set 'nitemode nil))))
viperscape /
Last active June 8, 2016 16:55
script to power on/off ec2 instances based on block times, reassociates eip if needed and saves cache of eips when rerun
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