Skip to content

Instantly share code, notes, and snippets.

View morris821028's full-sized avatar
💭
I may be slow to respond.

Morris Yang, Shiang-Yun Yang morris821028

💭
I may be slow to respond.
View GitHub Profile
@morris821028
morris821028 / img2txt.py
Created April 18, 2016 06:11
Image Process - Generator Testdata - Online Judge
import sys
import Image
import codecs
sys.stdout = codecs.getwriter('utf8')(sys.stdout)
for infile in sys.argv[1:]:
try:
im = Image.open(infile)
width = im.size[0]
height = im.size[1]
@morris821028
morris821028 / main.c
Created April 17, 2016 14:26
Judge Girl - Fast Matrix Multiplication (OpenMP) duff's device solution
#include <stdio.h>
#include "matrix.h"
// #define DEBUG
#define UINT unsigned long
#define MAXN 2048
void rand_gen(UINT c, int N, UINT A[][MAXN]) {
UINT x = 2, n = N*N;
for (int i = 0; i < N; i++) {
for (int j = 0; j < N; j++) {
@morris821028
morris821028 / 10091. Fast Matrix Multiplication (OpenCL).c
Last active April 16, 2016 14:58
Judge Girl 10091. Fast Matrix Multiplication (OpenCL)
#include <stdio.h>
#include <assert.h>
#include <inttypes.h>
#include <string.h>
#include <signal.h>
#include <unistd.h>
#include <CL/cl.h>
#define MAXGPU 8
#define MAXN 2048
@morris821028
morris821028 / add.py
Created March 11, 2016 01:40
TA work: add student account on server
import os
student = open('students')
for line in student.readlines():
line = line[:-1]
print line
cmd = "useradd -m -s /bin/bash -d /home/pp2016/%s %s" % (line, line)
psw = "echo %s:%s | chpasswd" % (line, line)
print cmd
@morris821028
morris821028 / script.sh
Created March 11, 2016 01:38
Build LLVM
mkdir -p ~/LLVM && cd ~/LLVM
wget -O - http://llvm.org/releases/3.7.1/llvm-3.7.1.src.tar.xz | tar Jxf -
wget -O - http://llvm.org/releases/3.7.1/cfe-3.7.1.src.tar.xz | \
tar Jxf - -C llvm-3.7.1.src/tools
cd /home/morris1028/LLVM/hw1
mkdir build && cd build
cmake /home/morris1028/LLVM/llvm-3.7.1.src
@morris821028
morris821028 / sched_test.cpp
Created November 3, 2015 14:17
RTS hw version 2
#include <cstdio>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#define _GNU_SOURCE
#include <pthread.h>
#include <unistd.h>
#include <sched.h>
#include <errno.h>
#include <cstdio>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#define _GNU_SOURCE
#include <pthread.h>
#include <unistd.h>
#include <sched.h>
#include <errno.h>
@morris821028
morris821028 / gist:12b7cb5ba3dfae8468b5
Created October 4, 2015 01:07
Mac TexShop Monokai-ish dark color scheme
# Monokai-ish dark color scheme
# background = 39 40 34 (#272822)
defaults write TeXShop background_R 0.15
defaults write TeXShop background_G 0.16
defaults write TeXShop background_B 0.13
# commands = 102 217 239 (#66D9EF)
defaults write TeXShop commandred 0.4
defaults write TeXShop commandgreen 0.85
@morris821028
morris821028 / hexo-migrate.js
Created August 19, 2015 02:40
hexo 2.8.3 to 3.1.1 tag plugin migrate
/*
$ npm install mkdirp --save
$ node hexo-migrate.js _post/
$ cd file_migrate/_post
*/
var fs = require("fs");
var path = require("path");
var mkdirp = require("mkdirp");
function file_migrate(file_path) {
@morris821028
morris821028 / hexo3.1.1.txt
Last active August 29, 2015 14:27
Hexo 2.8.3 to 3.1.1 錯誤訊息紀錄
* TypeError: undefined is not a function
```
{% blockquote%} -> {% blockquote %}
```
* Error: expected end of comment, got end of file
```
{% XXX %} \text{#YYY} {% endXXX %} -> {% XXX %} \text{YYY} {% endXXX %}
```
* void `{{` or `}}` or `{#` or `#}` in markdown file