Skip to content

Instantly share code, notes, and snippets.

View skytreader's full-sized avatar
🎭
"Code is poetry." - WordPress

Chad Estioco skytreader

🎭
"Code is poetry." - WordPress
View GitHub Profile
@skytreader
skytreader / ip_addresses.py
Created October 11, 2012 15:41
Quick Python script I whipped up to review for a Computer Networking exam.
BYTE = 8
def toBinaryString(num):
bitstring = ""
if num == 0:
bitstring = '0'
while num != 0:
bitstring = str(num % 2) + bitstring
@skytreader
skytreader / pack.py
Created June 3, 2013 07:52
Terribly inefficient SMS point-to-point packing.
#! /usr/bin/env python3
import math
"""
Proof-of-concept pseudocode for SMS point-to-point
packing.
"""
def pack(char_encodings):
@skytreader
skytreader / utils.js
Last active December 24, 2015 06:39
My javascript utility functions.
/**
* Set the character at a particular index in the given String.
*
* @param str
* The string to tweak.
* @param index
* The index where the replacement will take effect.
* @param chr
* The character to set in the given index.
*/
@skytreader
skytreader / Utils.java
Last active January 2, 2016 18:48
Java util snippets
/**
Parse an XML String. It may be worthwhile to cache the DocumentBuilder
object so we do not need to create an object everytime the method is
invoked.
@param xml
@return an org.w3c.dom.Document object
@referece http://stackoverflow.com/a/562207/777225
*/
public static Document loadXMLFromString(String xml) throws Exception
@skytreader
skytreader / exbin
Created January 27, 2014 02:58
creating executable tests in GTEST
g++ -isystem /opt/lib/gtest-1.7.0/include/ -pthread /opt/lib/gtest-1.7.0/fused-src/gtest/gtest_main.cc $1.cpp /opt/lib/gtest-1.7.0/libgtest.a -o $1
@skytreader
skytreader / worm.cpp
Last active August 29, 2015 13:55
The Worm Turns
#include <stdio.h>
#include <string.h>
#include <list>
#include <iostream>
#include <sstream>
using namespace std;
typedef struct point{
int row, col;
} point;
@skytreader
skytreader / __init__.py
Last active August 29, 2015 13:59
pydoc test
"""
An __init__ file, to make this a package.
"""
@skytreader
skytreader / ltest.ts
Last active May 9, 2017 09:24
Minimal Webpack Test
// Do assume there exists a lodash.js file in the same directory level./// <reference path="./model.ts" />
import "./lodash.js";
@skytreader
skytreader / diff_freeze.py
Created January 10, 2018 20:51 — forked from qgerome/diff_freeze.py
How to compare or diff 2 pip freeze or 2 requirements.txt in Python
"""
pip install click
"""
import click
import itertools
@skytreader
skytreader / package.json
Created December 17, 2019 13:41
Invalid Token Error SSCCE
{
"name": "invalid-token-sscce",
"version": "0.0.1",
"description": "",
"main": "index.js",
"engines": {
"node": ">=12"
},
"scripts": {
"test": "nyc ava",