Skip to content

Instantly share code, notes, and snippets.

View JesseEisen's full-sized avatar
🎯
Focusing

LinKang Chen JesseEisen

🎯
Focusing
View GitHub Profile
@JesseEisen
JesseEisen / bash-colors.md
Created January 12, 2018 05:40 — forked from iamnewton/bash-colors.md
The entire table of ANSI color codes.

Regular Colors

Value Color
\e[0;30m Black
\e[0;31m Red
\e[0;32m Green
\e[0;33m Yellow
\e[0;34m Blue
\e[0;35m Purple
@JesseEisen
JesseEisen / skip_list.c
Last active August 23, 2016 09:24
implementation of skip list in c
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
#define MAXLEVEL 7
typedef struct node{
int key;
int value;
struct node **next;
@JesseEisen
JesseEisen / nmcmp.sh
Created July 29, 2016 06:00
count and compare nm command output
#!/usr/bin/env bash
#usage:
#first step: generate the output
# nm -S --size-sort xxx1 > nm_output1
# nm -S --size-sort xxx2 > nm_output2
#second step: generate the count or diff
# ./nmcmp.sh nm_output1 nm_output2
# ./nmcmp.sh -d nm_output1 nm_output2 ##this will output with diff format.
@JesseEisen
JesseEisen / mytail.go
Created June 16, 2016 06:42
Go version tail implementation
package main
import (
"fmt"
"io/ioutil"
"log"
"os"
"strconv"
"strings"
)
@JesseEisen
JesseEisen / mytail.c
Created June 15, 2016 13:54
'tail -n' implemented by C
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define DEFLINES 10
#define MAXLEN 100
int getlines(char *s, int len){
int c, i;
@JesseEisen
JesseEisen / parser.awk
Created November 7, 2015 09:05
Use awk to parse a expression
#!/bin/awk
# input: a:=10
# output: the value is 10
BEGIN{ PrintRes() }
function parse() {
if(tok == "(eof)") return "(eof)"
while(length(line) == 0)
if(getline line == 0)
e.g. man -t bash | ps2pdf - bash.pdf
But sometimes ps2pdf may encounter an error, the reson is that '-' is not a filename, that's so weird. And i use the following
command to fix this error
e.g. man -t bash > temp
ps2pdf temp bash.pdf
It's temperaly way to solve this problem.
@JesseEisen
JesseEisen / sort_search.c
Created October 14, 2014 08:39
some sort function snippets
//easy way
void quicksort(int v[], int n)
{
int i, last;
if(n <= 1)
return;
swap(v,0, rand()%n);
last = 0;
@JesseEisen
JesseEisen / Linklist.c
Created October 9, 2014 07:06
A easy way to contruct a linklist and some base options. written by C
@JesseEisen
JesseEisen / Countline
Created September 23, 2014 12:26
Countline program, written by C
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
#include <dirent.h> /*some functions option on dir*/
#include <sys/stat.h>