Skip to content

Instantly share code, notes, and snippets.

View Lu-Yi-Hsun's full-sized avatar
🐱
Just cute

Anson Lu-Yi-Hsun

🐱
Just cute
  • Tunghai University
  • TAIWAN
View GitHub Profile
@Lu-Yi-Hsun
Lu-Yi-Hsun / .gitignore
Created December 14, 2022 20:55 — forked from jirihnidek/.gitignore
Example of (Linux) client-server aplication using ECN bit in UDP packets.
.cproject
.project
build
1. 編輯你的fullchain.pem vim /etc/letsencrypt/live/blaha.tw/fullchain.pem
2. 把這個intermediate certificate(https://letsencrypt.org/certs/letsencryptauthorityx1.pem.txt)加入fullchain的兩個certificate中間
3. restart你的webserver
@Lu-Yi-Hsun
Lu-Yi-Hsun / a.md
Last active May 1, 2020 05:07
#alg

dd

#include <stdio.h>
#include <stdlib.h>

typedef struct node {
  struct node* next;
  int value;
} Node;
@Lu-Yi-Hsun
Lu-Yi-Hsun / dict.py
Created January 17, 2020 07:26
dict
#!/usr/bin/python
try:
# Python2
import Tkinter as tk
except ImportError:
# Python3
import tkinter as tk
import os
import time
@Lu-Yi-Hsun
Lu-Yi-Hsun / ns-inet.sh
Last active December 1, 2019 18:08 — forked from dpino/ns-inet.sh
Setup a network namespace with Internet access
#!/usr/bin/env bash
IFACE="$1"
NS="$2"
VETH="veth1"
VPEER="vpeer1"
VETH_ADDR="10.200.1.1"
VPEER_ADDR="10.200.1.2"
if [[ $EUID -ne 0 ]]; then
@Lu-Yi-Hsun
Lu-Yi-Hsun / naming-netns.md
Created November 29, 2019 18:28 — forked from cfra/naming-netns.md
How to access an unnamed network namespace

Some programs might create network namespaces without registering them in /run/netns as iproute2 does. This makes it hard to access them with readily available tools like ip netns exec. However, there is a way to register those network namespace, after they have been created.

The following session creates and enters an unnamed namespace:

# unshare -n bash
# ip a l
1: lo:  mtu 65536 qdisc noop state DOWN group default qlen 1000
@Lu-Yi-Hsun
Lu-Yi-Hsun / todict.py
Created March 9, 2019 12:20 — forked from sungitly/todict.py
convert python object recursively to dict
def todict(obj, classkey=None):
if isinstance(obj, dict):
data = {}
for (k, v) in obj.items():
data[k] = todict(v, classkey)
return data
elif hasattr(obj, "_ast"):
return todict(obj._ast())
elif hasattr(obj, "__iter__"):
return [todict(v, classkey) for v in obj]
@Lu-Yi-Hsun
Lu-Yi-Hsun / ctags_with_dep.sh
Created May 26, 2018 12:03 — forked from xuhdev/ctags_with_dep.sh
Generate ctags file for C or C++ files and its depedencies (included header files). This could avoid you to always generate a huge tags file.
#!/bin/sh
# https://www.topbug.net/blog/2012/03/17/generate-ctags-files-for-c-slash-c-plus-plus-source-files-and-all-of-their-included-header-files/
# ./ctags_with_dep.sh file1.c file2.c ... to generate a tags file for these files.
gcc -M "$@" | sed -e 's/[\\ ]/\n/g' | \
sed -e '/^$/d' -e '/\.o:[ \t]*$/d' | \
ctags -L - --c++-kinds=+p --fields=+iaS --extra=+q
@Lu-Yi-Hsun
Lu-Yi-Hsun / CMakeLists.txt
Created February 23, 2018 11:41 — forked from fracek/CMakeLists.txt
CMake and GTK+ 3
# Set the name and the supported language of the project
PROJECT(hello-world C)
# Set the minimum version of cmake required to build this project
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
# Use the package PkgConfig to detect GTK+ headers/library files
FIND_PACKAGE(PkgConfig REQUIRED)
PKG_CHECK_MODULES(GTK3 REQUIRED gtk+-3.0)
# Setup CMake to use GTK+, tell the compiler where to look for headers
data a;
/*
infile 'D:\雜物夾\多變量\data6\t11-6.txt';
*/
input gp sex x1 x2;
cards;
1 2 108 368
1 1 131 355