Skip to content

Instantly share code, notes, and snippets.

@linnil1
linnil1 / scrape_ntu_course_by_R_simple.r
Last active September 18, 2016 13:53
new to R and use R to scrape ntu course
library("httr")
library("xml2")
library("magrittr")
webGet = function(query=list(),file="search_for_02_dpt.php") {
url = paste("http://nol.ntu.edu.tw/nol/coursesearch/",file,sep="")
return (GET(url,query=query) %>% content(encoding="Big5"))
}
if(FALSE){
# get all department
@linnil1
linnil1 / FSM_distribution_2D.py
Last active April 3, 2017 04:57
Material_HW
from sympy import symbols, simplify, Function, integrate, Basic, \
solve, linsolve, degree, LC, LT, expand, LM, plot
from sympy.printing.str import StrPrinter
class StepFunc(Function):
nargs = 2
@classmethod
from sympy import pi, cos, sin, sqrt, atan, atan2, N, oo
import matplotlib.pyplot as plt
import random
import time
from pprint import pprint
def getSum(arr, n):
pos = [0, 0]
for r, rho in arr[:n]:
from sympy import pi, cos, sin, sqrt, atan, atan2, N, oo
import matplotlib.pyplot as plt
from pprint import pprint
def getSum(arr, n):
pos = [0, 0]
for r, rho in arr[:n]:
if rho == oo:
continue
from sympy import pi, cos, sin, sqrt, atan, atan2, N, oo, symbols, solve
import matplotlib.pyplot as plt
import random
import time
from pprint import pprint
def getRange(arr):
leng = sum([a[0] for a in arr])
return -leng / 2, leng / 2
from sympy import pi, cos, sin, sqrt, atan, atan2, N, oo
import matplotlib.pyplot as plt
from pprint import pprint
import math
def getSum(arr, n):
pos = [0, 0]
for r, rho in arr[:n]:
if rho == oo:
const int pinarray[7] = {12,13,7,9,8,11,10};
const int digitarray[10] =
{0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,0x7F,0x6F};
void setup()
{
for(int i=0; i<7; ++i)
pinMode(pinarray[i], OUTPUT);
}
#include <string.h>
const char *letter = "**ETIANMSURWDKGOHVF?L?PJBXCYZQ??";
int letterlen = strlen(letter);
const char *want = "FOOT";
char morse[1000];
int morses = 0;
const int light = 5;
const int beepin = 6;
void setup()
# scan wifi
sudo iwlist wlan0 scan
# modify file to auto connect to wifi
sudo vim /etc/network/interfaces
# change wlan0 like this
auto lo
iface lo inet loopback
iface eth0 inet manual
# run script when boot
sudo vim /etc/rc.local
# add this line
su pi -c "tmux new-session -d 'python3 /home/pi/connect.py'" &
# when some website cannot connect
sudo vim /etc/resolv.conf
# comment all
# add this
nameserver 8.8.8.8