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
View keybase.md

Keybase proof

I hereby claim:

  • I am leomao on github.

  • I am leomao (https://keybase.io/leomao) on keybase.

  • I have a public key ASBXeji9z5TAstVXbfROPQ4y4SuIcKis5q9S0vD97VrjWwo

@leomao
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
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
leomao / pacfzf
Last active Sep 29, 2017
Use fzf to filter and select the search result from pacman (or pacaur)
View pacfzf
#!/bin/bash
if [[ -z $(command -v fzf) ]]; then
echo "You don't have fzf!!"
exit -1
fi
# collapse pacaur search result into oneline each entry
collapse() {
head=''
@leomao
leomao / watchsync.sh
Last active Feb 23, 2018
Watch file changes and sync two directories (to remote via ssh)
View watchsync.sh
#!/bin/bash
#
# Sync local directory to remote directory.
#
# Modified by: Leo Mao
# Modified from: https://gist.github.com/evgenius/6019316
#
# Requires Linux, bash, inotifywait and rsync.
#
# To avoid executing the command multiple times when a sequence of
@leomao
leomao / PKGBUILD
Created Mar 14, 2017
Cadivsor PKGBUILD
View PKGBUILD
pkgname=cadvisor
pkgver=0.25.0
pkgrel=1
pkgdesc="Analyzes resource usage and performance characteristics of running containers"
license=('Apache')
arch=('x86_64')
url='https://github.com/google/cadvisor'
makedepends=()
optdepends=()
source_x86_64=(
View pm_name.txt
中 日 英
妙蛙種子 フシギダネ Bulbasaur
妙蛙草 フシギソウ Ivysaur
妙蛙花 フシギバナ Venusaur
小火龍 ヒトカゲ Charmander
火恐龍 リザード Charmeleon
噴火龍 リザードン Charizard
傑尼龜 ゼニガメ Squirtle
卡咪龜 カメール Wartortle
水箭龜 カメックス Blastoise
@leomao
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) => {
console.log(data.toString().trim());
});
socket.on('end', () => {
console.log('socket end');
socket.end();
});
@leomao
leomao / ansistyle.py
Created Jan 30, 2017
ANSI style escape code
View ansistyle.py
# /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
leomao / colsure_compile.py
Created Jun 27, 2015
optimize javascript using closure compiler
View colsure_compile.py
#! /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.