Skip to content

Instantly share code, notes, and snippets.

View softstar1990's full-sized avatar

Jiaqi Zhu softstar1990

View GitHub Profile
@softstar1990
softstar1990 / diameter.py
Last active July 23, 2017 02:47
pyautocad
from pyautocad import Autocad, APoint
def find_diameter(load_kw):
if load_kw < 6:
return "DN25"
elif 6 <= load_kw < 13:
return "DN32"
elif 13 <= load_kw < 19:
return "DN40"
elif 19 <= load_kw < 39:
@softstar1990
softstar1990 / pip_upgrade_all.py
Created May 13, 2016 18:28
upgrade all packages
import pip
from subprocess import call
for dist in pip.get_installed_distributions():
call("pip install --upgrade " + dist.project_name, shell=True)
find . -name \*.doc -exec mv {} ~/Desktop/docx \;
find . -type d -empty -exec rmdir {} \;
find . -type d -empty -delete
@softstar1990
softstar1990 / snippets.py
Created June 15, 2015 02:11
Python snippets
# -*- coding: utf-8 -*-
"""
Created on Fri Jun 12 23:18:02 2015
@author: ZhuJiaqi
"""
# loop=======================================================
days = ["Mon","Tue","Wed","Thu","Fri","Sat","Sun"]
for i, d in enumerate(days):
print i, d
@softstar1990
softstar1990 / show.sh
Created August 22, 2014 04:51
show all file in mac
defaults write com.apple.Finder AppleShowAllFiles YES
@softstar1990
softstar1990 / rename.sh
Created August 11, 2014 23:41
rename files in a folder
#!/bin/bash
ls | while read -r FILE
do
mv -v "$FILE" `echo $FILE | tr ' ' '_' `
done
@softstar1990
softstar1990 / .bash_profile
Last active August 29, 2015 14:04
My bash_profile and bashrc
echo ""
echo -n "Welcome to Unix on Mac OS X, "; whoami
echo ""
echo -n "Today is "; date
echo ""
cal
if [ -f ~/.bashrc ]; then
source ~/.bashrc
fi