Skip to content

Instantly share code, notes, and snippets.

View bullno1's full-sized avatar
💭
Set your status

Bach Le bullno1

💭
Set your status
View GitHub Profile
@bullno1
bullno1 / ranch_ssl_hack.erl
Created September 30, 2021 08:25
Separate ssl options
%% Copyright (c) 2011-2018, Loïc Hoguin <essen@ninenines.eu>
%%
%% 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
@bullno1
bullno1 / keybase.md
Last active February 23, 2019 03:50
keybase.md

Keybase proof

I hereby claim:

  • I am bullno1 on github.
  • I am bullno1 (https://keybase.io/bullno1) on keybase.
  • I have a public key whose fingerprint is DB44 728B 3448 F054 9106 41C8 629D DEDA 535D 5331

To claim this, I am signing this object:

@bullno1
bullno1 / main.cpp
Created November 10, 2011 17:11
Dual number and auto differentiation in C++
#include <iostream>
template<typename Scalar>
class DualNumber
{
public:
inline DualNumber(const Scalar& realPart, const Scalar& dualPart = Scalar())
:mReal(realPart)
,mDual(dualPart)
{
> dig +trace +additional
# Root servers' results omitted
singtel.com. 172800 IN NS dnssec2.singnet.com.sg.
singtel.com. 172800 IN NS dnssec1.singnet.com.sg.
singtel.com. 172800 IN NS dnssec3.singnet.com.sg.
CK0POJMG874LJREF7EFN8430QVIT8BSM.com. 86400 IN NSEC3 1 1 0 - CK0Q1GIN43N1ARRC9OSM6QPQR81H5M9A NS SOA RRSIG DNSKEY NSEC3PARAM
CK0POJMG874LJREF7EFN8430QVIT8BSM.com. 86400 IN RRSIG NSEC3 8 2 86400 20170829044611 20170822033611 5528 com. fMS/MrwqmolNcat3BRaR2n4J6AWBXOB0JlPMZO6VbGVpSPHnWkJsX5ZL Nvyfu74g4kRly2Q2rqUHCO/sLrc2yviJVYPB0QFEMeaBDto7hKIVNvkh EiBN1TKrkzesBFLWse8n/+LvrmeW6ROtAMQ+LcfNYN3Utss9bqBmXgpB gPg=
OTF03HQV9N4L4M7OADG915MQBJ3RJDP5.com. 86400 IN NSEC3 1 1 0 - OTF1DMP586NMDP2JQM6RRE7P039RSSK2 NS DS RRSIG
@bullno1
bullno1 / PKGBUILD
Last active August 22, 2017 16:39
PKGBUILD for singularity
pkgname=singularity
pkgver=2.3.1.r23.gdddb21f4
pkgrel=1
pkgdesc="Application containers for Linux"
arch=('i686' 'x86_64')
license=('BSD')
url="https://github.com/singularityware/singularity"
depends=('python')
source=('git+https://github.com/singularityware/singularity')
makedepdends=('git')
@bullno1
bullno1 / schema.js
Created July 28, 2012 14:40
JSON schema validation
number = function(x) { return getType(x) == 'number'; }
string = function(x) { return getType(x) == 'string'; }
//combinators
function or() {
var len = arguments.length;
var args = arguments;
return function(x) {
for(var i = 0; i < len; ++i) {
if(validate(args[i], x)) return true;//satisfy at least one condition
@bullno1
bullno1 / test.rkt
Created October 8, 2011 12:10
Yo Dawg Scheme Interpreter
(load "yo_dawg.rkt")
(define test-fib
'[(define (fib n)
(if (<= n 2)
1
(+ (fib (- n 1)) (fib (- n 2)))))
(fib 6)])
(evaluate-block test-fib)
@bullno1
bullno1 / tail_recursion.cpp
Created October 2, 2011 06:34
Tail recursion in C++11
#include <iostream>
#include <functional>
template<typename ReturnType, typename Arg1>
struct tail_call_result
{
template<typename FuncType>
inline tail_call_result(FuncType func, Arg1 arg)
:func(func)
,argument(arg)
@bullno1
bullno1 / user_reg.apib
Created September 25, 2015 07:31
katt triple backtick
# Registration
Short passwords will be rejected:
```
PUT /users/bullno1
> Content-Type: application/json
> Accept: application/json
{"password": "short"}
< 400
@bullno1
bullno1 / give-me-ssd.py
Last active August 29, 2015 14:01
Give me SSD
#!/usr/bin/env python
import sys, httplib, urllib, hashlib, random, json
# Relevant JS code:
#
# return e = "52297d8e78ff8aed",
# t = CryptoJS.SHA256(Math.random().toString().substr(2, 5)).toString(),
# n = "//fastestgameonearth-com.herokuapp.com",
# $.ajax({