Skip to content

Instantly share code, notes, and snippets.

View JavaCS3's full-sized avatar
😑
Working

Charles Wei JavaCS3

😑
Working
View GitHub Profile
@JavaCS3
JavaCS3 / README.md
Last active November 1, 2020 11:14
2019 Personal Highlights

2019 Personal Highlights

Jan.

  1. 去美国北卡出差,第一次和美国人打德州扑克,去了Duke大学

Jun.

  1. 参加大学同学婚礼,当了第二次伴郎

Jul.

  1. 放弃公租房
@JavaCS3
JavaCS3 / README.md
Last active June 28, 2023 01:40
正则表达式学习

正则表达式学习

正则表达式是一个可以帮助我们匹配复杂字符串模式的工具

匹配字符(What)

  • .
  • [abcd] [a-zA-Z] [^abcd]
  • \d \s \t \w ...

匹配数量(How)

@JavaCS3
JavaCS3 / main.c
Created March 27, 2020 09:38
UUID String to C Array
#include <stdio.h>
#include <stdlib.h>
#define CHAR2INT(x) (('0' <= x && x <= '9') ? \
(x - '0') : \
(('a' <= x && x <= 'f') ? \
(10 + (x - 'a')) : \
(('A' <= x && x <= 'F') ? (10 + (x - 'A')) : (0))))
#define UUID2ARRAY(uuid) { \
const assert = require('assert')
const ENCODERS = {
raw(len) {
return function(v) {
assert(v instanceof Buffer)
const buffer = Buffer.alloc(len)
v.copy(buffer)
return buffer
@JavaCS3
JavaCS3 / color256.sh
Created August 5, 2019 13:44
color256.sh
for fgbg in 38 48 ; do #Foreground/Background
for color in {0..256} ; do #Colors
#Display the color
echo -en "\e[${fgbg};5;${color}m ${color}\t\e[0m"
#Display 10 colors per lines
if [ $((($color + 1) % 10)) == 0 ] ; then
echo #New line
fi
done
echo #New line
@JavaCS3
JavaCS3 / readme.md
Last active June 20, 2019 09:39
How to setup ssh proxy

How to setup ssh proxy

Add the following in your ~/.ssh/config

Host <dest domain/ip>
  ProxyCommand ssh -q -W %h:%p <proxy user>@<proxy domain/ip>

Example

@JavaCS3
JavaCS3 / quizz.md
Last active April 11, 2019 14:43
Interview Quizz

Interview Quizz: Cashier

A cashier in a shop need a program that will print out a receipt for a given order. And you're going to implement that.

Q1: Simple Printing

We're going to use some objects interaction to represent a payment process, and then print a receipt.

# python version
@JavaCS3
JavaCS3 / utils.py
Created February 18, 2019 03:03
Python color print and shell utils scripts
# Style Guide: https://github.com/google/styleguide/blob/gh-pages/pyguide.md
# Pythonic: https://docs.python-guide.org/writing/style/
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import sys
import string
@JavaCS3
JavaCS3 / submodule-helper.py
Created February 18, 2019 02:46
Update submodule revision recursively in case you have nested submodule
#!/usr/bin/env python
# Style Guide: https://github.com/google/styleguide/blob/gh-pages/pyguide.md
# Pythonic: https://docs.python-guide.org/writing/style/
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import re
@JavaCS3
JavaCS3 / index.html
Created September 13, 2017 10:03 — forked from orbitbot/index.html
Ace editor with http-link highlighting and click action, from http://jsbin.com/jehopaja/30/edit?html,output
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
<script src="http://ajaxorg.github.io/ace-builds/src/ace.js"></script>
<style>
#editor { position: absolute; top: 0; left: 0; right: 0; bottom: 0;}
.ace_link_marker {
position: absolute;