Skip to content

Instantly share code, notes, and snippets.

View breakds's full-sized avatar

Break Yang breakds

View GitHub Profile
@breakds
breakds / two-by-two-grid
Created July 4, 2014 09:25
A 2x2 grid.
<div>
<table style="border-collapse:collapse;">
<tr>
<td style="border:1px solid black; width:20px; height:20px;"></td>
<td style="border:1px solid black; width:20px; height:20px;"></td>
</tr>
<tr>
<td style="border:1px solid black; width:20px; height:20px;"></td>
<td style="border:1px solid black; width:20px; height:20px;"></td>
</tr>
@breakds
breakds / de_bruijn.py
Last active August 29, 2015 14:11
DeBruijn
def GenList(alphabet, k):
dict_size = len(alphabet)
node_size = k - 1
mask = dict_size ** (node_size - 1)
next_out = [0 for i in xrange(mask * dict_size)]
prefix = [0]
postfix = []
while 0 < len(prefix):
node = prefix[-1]
## this is a program that takes two txt file of company list and return a list of closest matches.
## name1.txt census name consist of three columns: stem_name1, full_name1, id1
## name2.txt corprate name consist of three columns: stem_name2, full_name2, id2
## read in the files
import sys
import re
import os
import shutil
fn construct_vector() -> Vec<i32> {
let mut result: Vec<i32> = vec![];
for i in 0..10 {
result.push(i);
}
result
}
@breakds
breakds / opencv2.BUILD
Created October 5, 2017 04:24
OpenCV2
# OpenCV highgui module can support various GUI libraries for capture.
# They can be enabled by including the corresponding .cpp files in
# modules/highgui/src/cap*. They are not enabled currently.
cc_library(
name = "highgui",
hdrs = glob([
"modules/highgui/src/grfmt*.hpp",
]) + [
"modules/highgui/src/precomp.hpp",
"modules/highgui/src/utils.hpp",
@breakds
breakds / chs.yml
Last active October 5, 2017 18:49
Example: Multi-language support in React.
pages:
home:
title: 首页
searchPlaceholder: 搜索功能尚未开放
armor:
title: 防具
armorSet: 套装
produce: 生产
weapon:
title: 武器
@breakds
breakds / nginx.nix
Created November 26, 2017 02:45
Nginx configuration
{ config, lib, pkgs, ... }:
{
networking.firewall.allowedTCPPorts = [ 80 443 8885 ];
services.nginx = {
enable = true;
recommendedProxySettings = true;
statusPage = true;
@breakds
breakds / keybase.md
Created September 30, 2019 03:21
keybase.md

Keybase proof

I hereby claim:

  • I am breakds on github.
  • I am breakds (https://keybase.io/breakds) on keybase.
  • I have a public key ASAnP3lGzPeEoxCzyLjxIm_M7RzbRWwryG8FvdjwwpXbLgo

To claim this, I am signing this object:

@breakds
breakds / catkin.nix
Created September 30, 2019 05:45
Packaging ROS on Nix
# Check https://github.com/airalab/airapkgs/blob/nixos-unstable/pkgs/development/ros-modules/catkin/default.nix
{ lib, pkgs, stdenv, fetchFromGitHub, callPackage,
python2Packages, ... }:
let
pname = "catkin";
version = "0.7.18";
subversion = "1";
rosdistro = "kinetic";
@breakds
breakds / indexing_test.py
Last active May 11, 2022 17:54
Demonstrate multi_threading in pytorch on tensor slicing (CPU)
import torch
import time
num_envs = 40
buffer_length = 1_000_000
buffer = torch.zeros([num_envs, buffer_length]).cpu()
B = 5120
T = 100