Skip to content

Instantly share code, notes, and snippets.

View leikahing's full-sized avatar
🧧
Chaining the blocks

William Lee leikahing

🧧
Chaining the blocks
View GitHub Profile
@leikahing
leikahing / Dockerfile
Created June 22, 2022 17:58
Dockerfile for Facebook Detectron2
FROM nvidia/cuda:11.1.1-cudnn8-devel-centos8
RUN cd /etc/yum.repos.d/ && \
sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-* && \
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-* && \
dnf check-update; dnf install -y ca-certificates python38 python38-devel git sudo which gcc-c++ mesa-libGL && \
dnf clean all
RUN alternatives --set python /usr/bin/python3 && alternatives --install /usr/bin/pip pip /usr/bin/pip3 1
@leikahing
leikahing / gdb-trace.log
Created August 1, 2020 20:51
HHVM core debugging
// Hunting down an issue stemming from https://github.com/facebook/hhvm/blob/master/hphp/runtime/base/string-data.cpp#L84
(gdb) bt
#0 raise (sig=11) at ../sysdeps/unix/sysv/linux/raise.c:50
#1 0x00000000049eca29 in HPHP::bt_handler(int, siginfo_t*, void*) (sigin=<optimized out>, info=<optimized out>)
at hphp/runtime/base/crash-reporter.cpp:270
#2 0x00007faf1f091b80 in <signal handler called> () at /usr/local/fbcode/platform007/lib/libpthread.so.0
#3 0x00000000008ecc55 in HPHP::StringData::MakeShared<true>(folly::Range<char const*>) (sl=...)
at buck-out/opt-hhvm-lto/gen/hphp/runtime/headers#header-mode-symlink-tree-only,headers,v5c9e8e3/hphp/runtime/base/header-
kind.h:233
@leikahing
leikahing / migratool.clj
Created February 21, 2018 18:45
A really quick Clojure program that validates the existence of files in S3
(ns migratool.core
(:gen-class)
(:require [clojure.string :as string]
[amazonica.core :refer :all]
[amazonica.aws.s3 :as s3]
[com.climate.claypoole :as cp]))
(def access-key "")
(def secret-key "")
(def bucket "")
@leikahing
leikahing / project.clj
Created January 7, 2018 17:01
project.clj
(defproject crane "1.0.0"
:description "High-throughput s3+dynamodb data crane"
:url "https://example.com"
:min-lein-version "2.0.0"
:dependencies [[org.clojure/clojure "1.8.0"]
[org.clojure/tools.logging "0.4.0"]
[ch.qos.logback/logback-classic "1.2.3"]
[amazonica "0.3.117"]
[cheshire "5.8.0"]
[compojure "1.6.0"]
@leikahing
leikahing / depth_sum.py
Last active October 31, 2017 18:42
Nested list summation
def depthSum(nestedList):
"""
:type nestedList: List[Things] where Things can be an int or more List[Things]
:rtype: int
"""
# This is a depth-first search as we need to find the deepest level and return sum
# at each depth
return dfs(nestedList, 1)
@leikahing
leikahing / heap.py
Created October 30, 2017 14:48
A really basic Heap implementation
class MaxHeap(object):
def __init__(self):
self.data = [0]
self.size = 0
def left_child(self, index):
if 2 * index <= self.size:
return 2*index
return None
@leikahing
leikahing / radix_sort.py
Created October 30, 2017 14:34
Basic Radix sort via Counting Sort
#!/usr/bin/env python
import math
import random
from itertools import filterfalse, tee
def get_digit(number, digit):
# Given number, pull the digit-th digit (starts at 0).
# e.g. get_digit(120, 2) => 1
# e.g. get_digit(120, 0) => 0
return number // 10**digit % 10
@leikahing
leikahing / product.json
Last active August 1, 2017 15:20
Some powershell stuff
{
"formatVersion" : "v1.0",
"disclaimer" : "This pricing list is for informational purposes only. All prices are subject to the additional terms included in the pricing pages on http://aws.amazon.com. All Free Tier prices are also subject to the terms included at https://aws.amazon.com/free/",
"offerCode" : "AmazonEC2",
"version" : "20170721022911",
"publicationDate" : "2017-07-21T02:29:11Z",
"products" : {
"76V3SF2FJC3ZR3GH" : {
"sku" : "76V3SF2FJC3ZR3GH",
"productFamily" : "Compute Instance",
@leikahing
leikahing / gitlab_errors.md
Last active July 14, 2022 21:20
Examples of Gitlab errors

This is one form of the error JSON. The message field is mapped to a String.

{
    "message":"400 (Bad request) \"title\" not given"
}

The error JSON can also take a more general form:

{

@leikahing
leikahing / keybase.md
Created July 7, 2017 20:39
Keybase verification

Keybase proof

I hereby claim:

  • I am birryree on github.
  • I am birryree (https://keybase.io/birryree) on keybase.
  • I have a public key whose fingerprint is 6D10 74DB 9CA4 5DC4 2209 9E0D B486 DA02 E9E6 906E

To claim this, I am signing this object: