Skip to content

Instantly share code, notes, and snippets.

View micromaomao's full-sized avatar
👋

maowtm micromaomao

👋
View GitHub Profile
use std::{io, mem};
use std::io::Write;
struct LockHolder {
stdout_ptr: *mut io::Stdout,
lock_ptr: *mut io::StdoutLock<'static>,
}
impl LockHolder {
fn new() -> Self {
@micromaomao
micromaomao / checkEr.js
Last active January 6, 2018 14:33
Check paper completeness for SchSrch
fetch('/subjects/?as=json').then(res => res.json()).then(subjs => {
function doSubject(i) {
if (i >= subjs.length) return void console.log('# Done!')
let subj = subjs[i]
console.log('# Doing ' + subj._id + '...')
checkSubject(subj).then(() => { doSubject(i + 1) })
}
function checkSubject (subj) {
return Promise.all(subj.times
.map(time => checkEr(subj._id, time).then(b => Promise.resolve([time, b]))))

Keybase proof

I hereby claim:

  • I am micromaomao on github.
  • I am maowtm (https://keybase.io/maowtm) on keybase.
  • I have a public key ASBWYlQ8_f1DPRN9slDQM7YssGskMcQkqn5VDEWly5RNGQo

To claim this, I am signing this object:

@micromaomao
micromaomao / .vimrc
Created August 4, 2016 08:27
My new .vimrc
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
SELECT * FROM (
SELECT
destinationAccount AS account,
round(
IFNULL((SELECT sum(credit) FROM transactions WHERE destinationAccount=tx.destinationAccount), 0)
- IFNULL((SELECT sum(credit) FROM transactions WHERE sourceAccount=tx.destinationAccount), 0)
, 9)
AS balance
FROM transactions tx
GROUP BY destinationAccount
@micromaomao
micromaomao / pub.sig
Created July 9, 2016 06:50
To sunbread
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
2B30339029E6CBD128779A876B8AA3FDC9DAF7AA is the GPG public key for this account: @micromaomao / MaoWtm ( GitHub )
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
iQIcBAEBCAAGBQJXgJ5xAAoJEGuKo/3J2veqixwQAKnDERmz5FPB0sCy+JI9mInq
vSwJOnzwoH81n94Tje8LyTX7GWCP/WdiZO3YrvtJPmLRda3Py9i3179hfrdo6JgB
fkRIP9jeJ/Nkp3bhKDVxt82b7QPkJUaY/tZ3F47JKjsDdQDsJEDdjf3BEFtcvI2n
@micromaomao
micromaomao / draw.js
Last active August 29, 2015 14:25
Draw a picture on your github user page
var dates = "";
$('.day').click(function(){dates += $(this).data('date') + "\n"; console.info($(this).data('date'));$(this).attr("fill", "#00ff00")})
@micromaomao
micromaomao / client.cc
Created July 15, 2015 11:00
Linux socket test
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#define BUFLEN 10
int main( int argc, char **argv )
@micromaomao
micromaomao / Makefile
Created July 8, 2015 10:31
This is my first GUI program in linux!
everything:
rm -f a.out
g++ main.cc `pkg-config --cflags --libs gtk+-3.0`
./a.out
@micromaomao
micromaomao / rename.py
Created July 6, 2015 02:20
Rename file, remove web address prefix
#!/usr/bin/python
import os;
import fnmatch;
for file in os.listdir('.'):
if fnmatch.fnmatch(file, "WWW.DOWNVIDS.NET-*.mp3"):
os.rename(file, file[17:])