Skip to content

Instantly share code, notes, and snippets.

View imshayne's full-sized avatar
🎯
Focusing

shayne imshayne

🎯
Focusing
View GitHub Profile
@imshayne
imshayne / VagrantFile
Created March 13, 2021 05:16
Startup centos7 quickly through vagrant (rewrite ip and network adapter)
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
@imshayne
imshayne / .tmux.conf.local
Created March 13, 2021 05:08
customize tmux configuration with .tmux
# : << EOF
# https://github.com/gpakosz/.tmux
# (‑●‑●)> dual licensed under the WTFPL v2 license and the MIT license,
# without any warranty.
# Copyright 2012— Gregory Pakosz (@gpakosz).
# -- navigation ----------------------------------------------------------------
# if you're running tmux within iTerm2
#---------------------------------------------------#
## 配置文件需要放置在 $HOME/.config/clash/config.yml
##
## 如果您不知道如何操作,请参阅 SS-Rule-Snippet 的 Wiki:
## https://github.com/Hackl0us/SS-Rule-Snippet/wiki/clash(X)
#---------------------------------------------------#
# HTTP 代理端口
port: 7890
@imshayne
imshayne / fibo.c
Created June 20, 2020 09:33
Fibonacci Number
int fibo(int);
int fibo(int N) {
if (0 == N) return 0;
if (1 == N || 2 == N) return 1;
int pre = 1, cur = 1;
for (int i = 3; i <= N; ++i) {
int sum = pre + cur;
pre = cur;
cur = sum;
}
@imshayne
imshayne / merge_dicts.py
Last active June 20, 2020 08:28
How to merge two dictionaries in python
# delcare two dicts with x and y
x = dict(a=1, b=2)
y = dict(b=2, c=5)
## in python 3.5+ ##
z = { **x, **y} # z = {'a': 1, 'b': 2, 'c': 5}
## in python 2.x ##