Skip to content

Instantly share code, notes, and snippets.

View bioball's full-sized avatar

Daniel Chao bioball

View GitHub Profile
@acutmore
acutmore / README.md
Last active January 21, 2024 20:30
Emulating a 4-Bit Virtual Machine in (TypeScript\JavaScript) (just Types no Script)

A compile-time 4-Bit Virtual Machine implemented in TypeScript's type system. Capable of running a sample 'FizzBuzz' program.

Syntax emits zero JavaScript.

type RESULT = VM<
  [
    ["push", N_1],         // 1
    ["push", False],       // 2
 ["peek", _], // 3
@bnoordhuis
bnoordhuis / bytestokey.js
Created November 29, 2017 22:55
Compute key+IV from passphrase (createCipher to createCipheriv migration script)
// Copyright (c) 2017, Ben Noordhuis <info@bnoordhuis.nl>
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
@auser
auser / App.js
Last active August 29, 2015 14:17
import React from 'react/addons';
import {RouteHandler,Navigation,Link, State} from 'react-router';
import {AuthenticationMixin} from '../mixins/authentication';
import {IntlMixin} from 'react-intl';
import SessionStore from '../stores/session_store';
import NavBarHeader from '../components/Navbar';
export default React.createClass({
@mbruner63
mbruner63 / gist:54500c54948fed517d3d
Created November 24, 2014 21:03
replacement code for Playground's ControlSensorsViewController.m
//
// ControlSensorsViewController.m
// playground
//
// Created by Kevin Liang on 11/18/14.
// Copyright (c) 2014 Wonder Workshop. All rights reserved.
//
// Modified by Martin Bruner 11/24/14
// Added state machine code for sound following
//
@cfj
cfj / console.clog.js
Last active April 2, 2021 18:17
console.clog
window.console.clog = function(log){
var message = typeof log === 'object' ? '%cLooks like you\'re trying to log an ' : '%cLooks like you\'re trying to log a ',
style = 'background:url(http://i.imgur.com/SErVs5H.png);padding:5px 15px 142px 19px;line-height:280px;';
console.log.call(console, message + typeof log + '.', style);
};
@urcadox
urcadox / RSA.scala
Created August 7, 2013 12:57
RSA encryption in Scala
package util
import java.security._
import java.security.spec.X509EncodedKeySpec
import javax.crypto._
import org.apache.commons.codec.binary.Base64
object RSA {
def decodePublicKey(encodedKey: String): Option[PublicKey] = {
this.decodePublicKey(