Skip to content

Instantly share code, notes, and snippets.

Yen3 yen3

Block or report user

Report or block yen3

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@yen3
yen3 / sync
Created Dec 19, 2019
sync vscode
@yen3
yen3 / gist:8c0f7dd012cd8b3b9b07b6992c82e96f
Last active Dec 2, 2019 — forked from ram535/gist:b1b7af6cd7769ec0481eb2eed549ea23
Reuse the same terminal in neovim. (Open the terminal in below)
View gist:8c0f7dd012cd8b3b9b07b6992c82e96f
" With this function you can reuse the same terminal in neovim.
" You can toggle the terminal and also send a command to the same terminal.
let s:monkey_terminal_window = -1
let s:monkey_terminal_buffer = -1
let s:monkey_terminal_job_id = -1
function! MonkeyTerminalOpen()
" Check if buffer exists, if not create a window and a buffer
if !bufexists(s:monkey_terminal_buffer)
@yen3
yen3 / dlt-daemon-2160-debian-buster.patch
Created Sep 6, 2019
Build dlt-daemon v2.16.0 in debian buster
View dlt-daemon-2160-debian-buster.patch
diff --git a/src/console/dlt-control-common.c b/src/console/dlt-control-common.c
index 3973059..84d441c 100644
--- a/src/console/dlt-control-common.c
+++ b/src/console/dlt-control-common.c
@@ -210,7 +210,7 @@ int dlt_parse_config_param(char *config_id, char **config_data)
{
*(config_data) = (char*)
calloc(DLT_DAEMON_FLAG_MAX, sizeof(char));
- strncpy(*config_data,
+ memcpy(*config_data,
@yen3
yen3 / Caddyfile
Last active Dec 16, 2018
Example for https docker-gitlab under reversed proxy environment - Caddy http server
View Caddyfile
https://gitlab.example.com {
proxy / https://localhost:10443 {
insecure_skip_verify
transparent
}
tls {
dns gandiv5
}
}
@yen3
yen3 / Dockerfile
Created Aug 5, 2018
Build Tapir LLVM for fun
View Dockerfile
FROM ubuntu:18.04
RUN sed -i 's/archive.ubuntu.com/tw.archive.ubuntu.com/g' /etc/apt/sources.list \
&& rm /etc/dpkg/dpkg.cfg.d/excludes \
&& apt update \
&& dpkg -l | grep ^ii | cut -d' ' -f3 | xargs apt install -y --reinstall \
&& apt install -y build-essential git man python cmake\
&& git clone --recursive https://github.com/wsmoses/Tapir-Meta.git \
&& cd /Tapir-Meta \
&& ./build.sh release \
View goldbach.hs
goldbach :: Int -> Maybe (Int, Int)
goldbach n = let ps = [(x, n-x) | x <- [2..(n `div` 2)], isPrime x, isPrime (n-x)]
in safeFst ps
where isPrime n = and (map (\x -> n `mod` x /= 0) [2..(n-1)])
safeFst [] = Nothing
safeFst (x:xs) = Just x
@yen3
yen3 / api_doc_gen.py
Last active Apr 22, 2018
tornado memo
View api_doc_gen.py
# Credit: https://github.com/hfaran/Tornado-JSON/blob/master/tornado_json/api_doc_gen.py
import re
import inspect
import types
import itertools
import tornado.web
from tornado.web import RequestHandler
@yen3
yen3 / aarch64_virt_install.sh
Last active Jan 13, 2020
aarch64 virt-install commands
View aarch64_virt_install.sh
#!/bin/bash
rm -rf /home/yen3/ubuntu.qcow2
qemu-img create -f qcow2 /home/yen3/ubuntu.qcow2 10G
virsh undefine ubuntu1604arm64 --nvram
install_from_localtion() {
virt-install -n ubuntu1604arm64 --memory 1024 --arch aarch64 --vcpus 1 \
--disk /home/yen3/ubuntu.qcow2,device=disk,bus=virtio \
@yen3
yen3 / striter.py
Created Mar 9, 2018 — forked from anacrolix/striter.py
A Python IO class wrapping an iterable of strings.
View striter.py
import io
class StringIteratorIO(io.TextIOBase):
def __init__(self, iter):
self._iter = iter
self._left = ''
def readable(self):
return True
@yen3
yen3 / build_llvm.sh
Last active Sep 9, 2019
Build llvm manually
View build_llvm.sh
#!/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)
You can’t perform that action at this time.