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 / iden.py
Created April 25, 2020 21:40
iden.py
from flask import Flask
app = Flask(__name__)
"""
Usage: Install Flask, export this file as the `FLASK_APP` then `flask run`.
The resulting server will return the status code you as it for. Exemple gratis:
curl 127.0.0.1/404 - will return a 404
curl 127.0.0.1/500 - will return a 500
@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",
@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 / 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 / __init__.py
Last active August 29, 2015 13:59
pydoc test
"""
An __init__ file, to make this a package.
"""
@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 / 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 / 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 / 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 / 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):