Skip to content

Instantly share code, notes, and snippets.

🖤

Shao Cheng TerrorJack

🖤
Block or report user

Report or block TerrorJack

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View jsval-gc.hs
{-# LANGUAGE MagicHash #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE UnboxedTuples #-}
{-# OPTIONS_GHC -Wall -O2 #-}
import Data.Foldable
import GHC.Exts
import GHC.Types
import System.Mem
View fetch-node.py
#!/usr/bin/env python3
from io import BytesIO
import json
import os
from sys import argv
import tarfile
from urllib.request import urlopen
View cont.hs
{-# LANGUAGE OverloadedStrings #-}
import qualified Data.ByteString as BS
import qualified Data.ByteString.Unsafe as BS
import Data.Char
import Data.Time.Clock.POSIX
import qualified DynFlags as GHC
import Foreign
import qualified GHC
import GHC.ForeignPtr
View v8-options.txt
SSE3=1 SSSE3=1 SSE4_1=1 SSE4_2=1 SAHF=1 AVX=1 FMA3=1 BMI1=1 BMI2=1 LZCNT=1 POPCNT=1 ATOM=0
Synopsis:
shell [options] [--shell] [<file>...]
d8 [options] [-e <string>] [--shell] [[--module] <file>...]
-e execute a string in V8
--shell run an interactive JavaScript shell
--module execute a file as a JavaScript module
Note: the --module option is implicitly enabled for *.mjs files.
@TerrorJack
TerrorJack / haproxy.cfg
Created Oct 3, 2019 — forked from cmer/haproxy.cfg
Simple, no bullshit TCP port forwarding using HAProxy
View haproxy.cfg
listen l1
bind 0.0.0.0:443
mode tcp
timeout connect 4000
timeout client 180000
timeout server 180000
server srv1 host.example.com:9443
View loadX.hs
{-# LANGUAGE GADTs #-}
import Control.Monad
import Control.Monad.IO.Class
import Data.Char
import Data.Foldable
import Data.List
import qualified DynFlags as GHC
import qualified GHC
import qualified GHCi.Message as GHC
@TerrorJack
TerrorJack / sem.mjs
Created Aug 6, 2019
Async JavaScript Semaphores
View sem.mjs
function semSetPromise(sem) {
delete sem.promise;
delete sem.resolve;
sem.promise = new Promise(resolve => {
if (sem.left) {
--sem.left;
resolve();
} else {
sem.resolve = resolve;
}
@TerrorJack
TerrorJack / Pool.hs
Created Aug 2, 2019
Memory pool backed by ghc storage manager
View Pool.hs
{-# LANGUAGE MagicHash #-}
{-# LANGUAGE UnboxedTuples #-}
module Pool
( Pool
, newPool
, freePool
, pooledMallocBytes
, pooledReallocBytes
, pooledFree
View ghc-submodule-remove.sh
#!/bin/sh -e
git rm --cached libraries/binary
rm -rf libraries/binary/.git
git add libraries/binary
git rm --cached libraries/bytestring
rm -rf libraries/bytestring/.git
git add libraries/bytestring
@TerrorJack
TerrorJack / channel.mjs
Last active Aug 7, 2019
Async JavaScript Channels
View channel.mjs
function newThunk(f) {
let t = () => {
const r = f();
t = () => r;
return r;
};
return () => t();
}
function newNode() {
You can’t perform that action at this time.