Skip to content

Instantly share code, notes, and snippets.

View forAllBright's full-sized avatar
:octocat:
Focusing

forAllBright forAllBright

:octocat:
Focusing
View GitHub Profile
@forAllBright
forAllBright / for 高级用法-不能动态删除元素.java
Last active June 10, 2020 00:04
Java Tricks #Java #FalliblePoint
// 在 for 的高级用法中不能动态的删除集合元素。
public class Test {
public static void main(String[] args) {
ArrayList<String> str = new ArrayList<>();
str.add("h");
str.add("e");
str.add("ll");
str.add("o");
for(String i:str) {
if(i.equals("e")) {
@forAllBright
forAllBright / kill python processes
Created December 7, 2018 12:29 — forked from Lh4cKg/kill python processes
kill all python process
[innotec@innotec ~]$ ps aux | grep 'manage.py' | awk '{print $2}' | xargs kill -9
# add alias in .bashrc
# kill python processes
alias ppsk="pkill -f manage.py"
# or
[innotec@innotec ~]$ killall python
# or
alias pk="ps aux | grep 'manage.py' | awk '{print $2}' | xargs kill -9"
@forAllBright
forAllBright / win7-bootable-usb-on-osx.md
Created December 3, 2018 08:27
Create a Bootable Win7 USB Stick on OSX

Create a Bootable Win7 USB Stick on OSX

Prerequesites:

  • 4GB+ USB Stick
  • Windows 7 ISO from Microsoft downloaded to your OSX-Machine

Preparing the drive

  1. Open Disk utility
  2. Find the drive, format it with the following options:
  • Choose Master Boot Record (MBR)
@forAllBright
forAllBright / time转stamp.py
Last active November 17, 2018 06:43
Python时间类型 #Python #TimeType
#时间转为时间戳
def time_handle(time_in): #time_in is str type
d = datetime.datetime.strptime(time_in, "%m/%d/%Y %H:%M:%S")
x1 = time.mktime(d.timetuple()) #get the timestamp
return x1
@forAllBright
forAllBright / 添加标题行.py
Last active May 4, 2018 06:32
Python DataFrame基本操作 #Python #Pandas
# 读取 csv 文件,添加标题行
mobi = r"/Users/pmz/Project/MOBIKE_CUP_2017/225W.csv"
df = pd.read_csv(mobi,header=0,names=['time','number'])
print(df.head())