Skip to content

Instantly share code, notes, and snippets.

View alan-w-255's full-sized avatar

alan alan-w-255

  • 四川大学
  • 四川省成都市
View GitHub Profile
@alan-w-255
alan-w-255 / play.py
Last active March 31, 2017 05:37
python codecs 解决文件中文编码错误
#%%
import codecs, sys
import json
f = codecs.open('crawl.json', 'r', 'utf-8','ignore')
data = json.load(f)
for x in data:
try:
print(x['mblog_text'])
except KeyError:
pass
import threading
import random
import time
num_of_head_north = 0
num_of_head_south = 0
counter_lock = threading.Lock()
bridge_cond = threading.Condition()
bridge_sem = threading.BoundedSemaphore(3)

the origin of war

To figure out the origin of war, we need to find out what is war.

the wikipedia says,

War is a state of armed conflict between societies. It is generally characterized by extreme aggression, destruction, and mortality, using regular or irregular military forces.

维基百科对战争的定义, 社会之间武装冲突的一种状态

@alan-w-255
alan-w-255 / sources.list
Created November 29, 2017 10:04
ubuntu 16.04 apt 源 修改为阿里云
# deb cdrom:[Ubuntu 16.04 LTS _Xenial Xerus_ - Release amd64 (20160420.1)]/ xenial main restricted
deb-src http://archive.ubuntu.com/ubuntu xenial main restricted #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted multiverse universe #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted multiverse universe #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe
deb http://mirrors.aliyun.com/ubuntu/ xenial multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates multiverse
@alan-w-255
alan-w-255 / index.js
Created July 2, 2018 02:12
es5 冻结对象
var constantize = (obj) => {
Object.freeze(obj);
Object.keys(obj).forEach( (key, i) => {
if (typeof obj[key] === 'object') {
constantize(obj[key]);
}
})
}
@alan-w-255
alan-w-255 / keybase.md
Created September 14, 2019 08:24
keybase.md

Keybase proof

I hereby claim:

  • I am alan-w-255 on github.
  • I am alan0w0 (https://keybase.io/alan0w0) on keybase.
  • I have a public key ASCvtPyjP6MgXl7jdot4vnpVaDTFDsuVj5MzVvBQcWRPqQo

To claim this, I am signing this object:

@alan-w-255
alan-w-255 / player_controller.gd
Created July 26, 2020 04:44
GDScript: First person controller
extends KinematicBody
###################-VARIABLES-####################
# Camera
export(float) var mouse_sensitivity = 12.0
export(NodePath) var head_path
export(NodePath) var cam_path
export(float) var FOV = 80.0
var mouse_axis := Vector2()