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 / 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 / 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 / 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 / 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 / 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 / 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 / fig-parallel-n.tex
Last active December 14, 2016 03:02
Paper pgfplot example
\begin{tikzpicture}[scale=0.4,font=\sffamily]
\begin{axis}[
xlabel={Processor $p$},
ylabel={Time (second)},
xmin=1, xmax=16,
ymin=0, ymax=1.2,
scaled ticks = false,
tick label style={/pgf/number format/fixed},
xtick={1, 2, 4, 8, 16},
ytick={0, 0.2, 0.4, 0.6, 0.8, 1, 1.2},
@morris821028
morris821028 / main.c
Created September 24, 2016 01:47
[debug] Judge Girl 33. Intersections Submission 73738
#include<stdio.h>
int main(void)
{
int a[101][101]={0},n,i,j,k,A=0,B=0,C=0,D=0;
scanf("%d",&n);
for(i=1;i<=n;i++)
{
for(j=1;j<=n;j++)
{
@morris821028
morris821028 / nvprof.sh
Created May 14, 2016 02:17
CUDA Profiler Script on nVidia Driver
#!/bin/bash
TEXT_RED=`tput setaf 1`
TEXT_GREEN=`tput setaf 2`
TEXT_RESET=`tput sgr0`
CONFIG_FILE=nvvp.cfg
if [ ! -f $CONFIG_FILE ];
then
echo "[ERROR] Profile config file ${TEXT_RED}nvvp.cfg${TEXT_RESET} does not exist."
@morris821028
morris821028 / nvprof.sh
Created May 3, 2016 02:50
OpenCL Profiler Script on nVidia Driver
#!/bin/bash
TEXT_RED=`tput setaf 1`
TEXT_GREEN=`tput setaf 2`
TEXT_RESET=`tput sgr0`
CONFIG_FILE=nvvp.cfg
if [ ! -f $CONFIG_FILE ];
then
echo "[ERROR] Profile config file ${TEXT_RED}nvvp.cfg${TEXT_RESET} does not exist."