Skip to content

Instantly share code, notes, and snippets.

View yen3's full-sized avatar

Yen3 yen3

  • Taiwan
View GitHub Profile
@yen3
yen3 / build_llvm.sh
Last active September 9, 2019 05:50
Build llvm manually
#!/bin/bash
set -ex
PREFIX=$HOME/usr/tools/llvm
LLVM_VERSION=7.0.0
BASE_URL=https://github.com/llvm/llvm-project/releases/download/llvmorg-${LLVM_VERSION}
COMPOMENT=(llvm cfe compiler-rt libcxx libcxxabi openmp clang-tools-extra polly libunwind)
@yen3
yen3 / dump_call_graph.cpp
Last active November 11, 2016 14:09
GCC plugin: dump call graph for a single file.
#include "gcc-plugin.h"
#include "plugin-version.h"
#include "tree.h"
#include "cgraph.h"
#include <string>
#include <vector>
#include <map>
@yen3
yen3 / build_ctags_cscope_gcc.sh
Last active November 11, 2016 03:32
A simple script to create ctags & cscope files for gcc 6.2.0
#!/usr/bin/env bash
find . -type f ! -path "*testsuite*" \
! -path "./.git/*" \
! -path "./gcc/testsuite/*" \
! -path "./INSTALL/*" \
! -path "./config/*" \
! -path "./libquadmath/*" \
! -path "./libssp/*" \
! -path "./libgo/*" \
! -path "./libtm/*" \
@yen3
yen3 / zshrc.zsh
Created October 10, 2016 14:11
Try set zshrc with zplug
source ~/.zplug/init.zsh
zplug "zplug/zplug"
#zplug "zsh-users/zsh-history-substring-search"
#zplug "zsh-users/zsh-completions"
#zplug "zsh-users/zsh-syntax-highlighting"
# Prezto
zplug "modules/prompt", from:prezto
zstyle ':prezto:module:prompt' theme 'yen3'
@yen3
yen3 / gist:3a264578e79e213a692135f98bd1a2a2
Created June 14, 2016 05:54 — forked from lttlrck/gist:9628955
rename git branch locally and remotely
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
@yen3
yen3 / Mandelbrot.hs
Last active September 20, 2021 06:33
MandelbrotSet practice --- sequence and basic parallel version
{-# LANGUAGE BangPatterns #-}
-- Compile command: ghc -O2 Mandelbrot.hs -rtsopts -threaded -fllvm
import qualified Control.Monad.Par as Par
import Control.Parallel.Strategies (parList, rseq, using)
import Data.Binary.IEEE754 (putFloat64le)
import Data.Binary.Put
import qualified Data.ByteString.Lazy as BL
import Data.Time.Clock (diffUTCTime, getCurrentTime)
@yen3
yen3 / list_dir.hs
Last active August 29, 2015 14:22
List files in a directory recursively
module ListFiles where
import System.Directory
import System.FilePath.Posix
split:: [a] -> [Bool] -> ([a], [a])
split xs bs = foldr s ([], []) (zip xs bs)
where s (d, i) (y, z) = if i then (d:y, z) else (y, d:z)
isSpecialFile :: FilePath -> Bool
from __future__ import print_function
class Attribute(object):
def __init__(self):
pass
def main():
a = Attribute();
print(a.__dict__)
a.__setattr__("test", 5)
@yen3
yen3 / singleton.hpp
Last active August 29, 2015 14:03
multiple reference for a single object in C++
class Singleton{
public:
static const Singleton& getInstance(){
static Singleton single;
return single;
};
private:
Singleton():a(0){};
unsigned int a;
};
@yen3
yen3 / install_cmd.hs
Last active December 27, 2015 05:59
Install commands for programming envrionment.
import Data.List
import System.Cmd
type ExecuteCmd = String
type Option = String
type OptionList = [Option]
data Command = Cmd ExecuteCmd OptionList
deriving (Show, Eq)