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 / bar.cpp
Created March 5, 2017 14:19
processbar.cpp
#include <bits/stdc++.h>
#ifdef _WIN64
#include <windows.h>
#else
#include <unistd.h>
#endif
using namespace std;
void do_timecomsuming_work() {
#ifdef _WIN64
@morris821028
morris821028 / Latex.sublime-settings
Created March 7, 2017 06:18
Sublime Text 2 Reference
{
"rulers":[72],
"word_wrap": true,
"spell_check": true,
"dictionary": "Packages/Language - English/en_US.dic"
}
@morris821028
morris821028 / gist:46069795159847c6b584fb2a0d92a414
Created April 27, 2017 06:40 — forked from ibogun/gist:ec0a4005c25df57a1b9d
Installing gcc 4.9 & g++ 4.9 on Ubuntu 12.04 OR Ubuntu 14.04
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install gcc-4.9
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 50
sudo apt-get install g++-4.9
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.9 50
@morris821028
morris821028 / Makefile
Last active May 16, 2017 05:23
[SSE Acc] Pi - Monte Carlo method
all: pi
pi: pi.c
gcc-4.8 -Wall -std=c99 -O2 pi.c -o pi-4.8
gcc-5 -std=c99 -O2 pi.c -o pi-5
gcc-6 -std=c99 -O2 -march=native -msse -mavx pi.c -o pi-6
gcc-4.8 -Wall -std=c99 -O2 -msse -msse2 -mavx pi-sse.c -o pi-sse
clang-3.8 -O2 pi.c -o pi-clang
@morris821028
morris821028 / diff-img.py
Created May 16, 2017 14:38
Image Difference with Heat map
"""
python ./diff-img.py lhs.jpg rhs.jpg
"""
import numpy as np
import sys
from PIL import Image
def rgb(minimum, maximum, value):
minimum, maximum = float(minimum), float(maximum)
ratio = 2 * (value-minimum) / (maximum - minimum)
@morris821028
morris821028 / main.c
Created May 19, 2017 12:19
dynamic 2d range sum
#include <stdio.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <inttypes.h>
#include <assert.h>
#include <x86intrin.h>
typedef struct Rect {
int32_t lx, ly, rx, ry;
} Rect;
@morris821028
morris821028 / format.sh
Created June 14, 2017 04:52
Format Your C Code on Miwa
INPUT=main.c
# inplace format `-i`
clang-format-3.8 -i -style="{BasedOnStyle: llvm, IndentWidth: 4}" main.c
# output the result on the screen
clang-format-3.8 -style="{BasedOnStyle: llvm, IndentWidth: 4}" main.c
# more detail config
clang-format-3.8 -style="{BasedOnStyle: llvm, IndentWidth: 4}" -dump-config
@morris821028
morris821028 / encrypt.sh
Created June 21, 2017 05:49
Master Thesis Script
#!/bin/bash
IFS= read -s -p "Please Enter Password of the Change Permissions: " pwd
pdftk thesis.pdf output thesis-security.pdf \
owner_pw $(pwd) \
allow printing ScreenReaders \
encrypt_128bit
@morris821028
morris821028 / multi-judge.py
Created July 4, 2017 03:36
Testing Parallel-judge
#!/usr/bin/python3
import threading
import time
import queue
import random
def work(wid, wlock, wset, q):
while True:
if not q.empty():
@morris821028
morris821028 / 1.txt
Last active August 28, 2017 12:20
身心障礙者權利公約
1. 針對匈牙利智能障礙者選舉投票案例,以下哪些敘述是正確的?
c. 限制智能障礙者之投票權,違反公約第二十九條參與政治與公共生活
d. 匈牙利政府因其未提供身障者在行使權利能力時可能需要之協助,故違反公約第十二條在法律之前獲得平等承認
2. 身心障礙者權利公約,是二十一世紀第一個國際人權條約,將影響全球六億身心障礙者的權利保障, 可說是國際人權的重要發展。
O
3. 在匈牙利智能障礙者選舉投票案例中,我們可以知道,若身障者因為智能問題,是可以依照國家的法律來禁止他們投票的。
X