Skip to content

Instantly share code, notes, and snippets.

Leo Mao leomao

  • Taiwan
Block or report user

Report or block leomao

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

Keybase proof

I hereby claim:

  • I am leomao on github.

  • I am leomao ( on keybase.

  • I have a public key ASBXeji9z5TAstVXbfROPQ4y4SuIcKis5q9S0vD97VrjWwo

leomao / cuda101.patch
Created Aug 4, 2019
warp-ctc cuda 10.1 patch
View cuda101.patch
diff --git a/include/contrib/moderngpu/include/device/intrinsics.cuh b/include/contrib/moderngpu/include/device/intrinsics.cuh
index a601443..4be77a8 100644
--- a/include/contrib/moderngpu/include/device/intrinsics.cuh
+++ b/include/contrib/moderngpu/include/device/intrinsics.cuh
@@ -112,7 +112,7 @@ __device__ __forceinline__ float shfl_up(float var,
unsigned int delta, int width = 32) {
#if __CUDA_ARCH__ >= 300
- var = __shfl_up(var, delta, width);
+ var = __shfl_up_sync(0xFFFFFFFF, var, delta, width);
leomao / tetris_in_one.cpp
Created Nov 11, 2017
Tetris battle in one cpp
View tetris_in_one.cpp
// Author: LeoMao
// Filename: tetris.cpp
// Purpose: simulate tetris battle
// encoding: UTF-8
// Features:
// => basic tetris battle game control
// => can see next 5 pieces
// => can hold just like tetris battle
leomao / pacfzf
Last active Sep 29, 2017
Use fzf to filter and select the search result from pacman (or pacaur)
View pacfzf
if [[ -z $(command -v fzf) ]]; then
echo "You don't have fzf!!"
exit -1
# collapse pacaur search result into oneline each entry
collapse() {
leomao /
Last active Feb 23, 2018
Watch file changes and sync two directories (to remote via ssh)
# Sync local directory to remote directory.
# Modified by: Leo Mao
# Modified from:
# Requires Linux, bash, inotifywait and rsync.
# To avoid executing the command multiple times when a sequence of
leomao / PKGBUILD
Created Mar 14, 2017
pkgdesc="Analyzes resource usage and performance characteristics of running containers"
View pm_name.txt
中 日 英
妙蛙種子 フシギダネ Bulbasaur
妙蛙草 フシギソウ Ivysaur
妙蛙花 フシギバナ Venusaur
小火龍 ヒトカゲ Charmander
火恐龍 リザード Charmeleon
噴火龍 リザードン Charizard
傑尼龜 ゼニガメ Squirtle
卡咪龜 カメール Wartortle
水箭龜 カメックス Blastoise
leomao / client.js
Created Mar 7, 2017
socket in node
View client.js
const net = require('net');
socket = net.createConnection(54321);
socket.on('data', (data) => {
socket.on('end', () => {
console.log('socket end');
leomao /
Created Jan 30, 2017
ANSI style escape code
# /usr/bin/env python
# Copyright (C) 2017 Leo Mao
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
leomao /
Created Jun 27, 2015
optimize javascript using closure compiler
#! /usr/bin/env python3
import http.client, urllib.parse, sys
# Define the parameters for the POST request and encode them in
# a URL-safe format.
params = urllib.parse.urlencode([
('js_code', sys.argv[1]),
('compilation_level', 'SIMPLE_OPTIMIZATIONS'),
You can’t perform that action at this time.