Skip to content

Instantly share code, notes, and snippets.

class VideoIMUFusion::RunningData
{
public:
private:
FilterState& state()
{
return m_state;
}
FilterState const& state() const
class VideoIMUFusion::RunningData
{
public:
private:
FilterState& state()
{
return m_state;
}
FilterState const& state() const
import requests
from bs4 import BeautifulSoup
import base64
payload = {}
res = requests.get('http://www.twse.com.tw/ch/trading/exchange/BWIBBU/BWIBBU_d.php')
res.encoding = 'big5'
soup = BeautifulSoup(res.text)
for input_tag in soup.select('input'):
if input_tag.get('type') == 'hidden':
payload[input_tag.get('name')] = base64.b64encode(input_tag.get('value').encode('utf-8'))
@shihyu
shihyu / twse.py
Created April 26, 2016 14:27 — forked from flyakite/twse.py
import BeautifulSoup, requests
r=requests.post('http://www.twse.com.tw/ch/trading/exchange/BWIBBU/BWIBBU.php', {'STK_NO':2330, 'myear': 2016, 'mmon':2})
soup = BeautifulSoup.BeautifulSoup(r.content)
table = soup.find('table', {'class':'board_trad'})
with open('out2.csv', 'w') as f:
trs = table.findAll('tr')
for tr in trs:
#include <stdio.h>
#include <pthread.h>
#include <unistd.h>
static pthread_mutex_t Cmtx = PTHREAD_MUTEX_INITIALIZER;
void* ap1_thread(void* args)
{
while (1) {
pthread_mutex_lock(&Cmtx);
CC = gcc
SOFLAGS = -shared
LDFLAGS = -lm
CFLAGS = -Wall -pedantic -ggdb3 -O0 -std=c99 -lpthread -fPIC -shared
ADD_OBJS = add.o
SUB_OBJS = sub.o
all: add.so sub.so
int add(int a, int b)
{
return a + b;
}
@shihyu
shihyu / mp_crawler.py
Created August 4, 2016 19:27 — forked from laing20333/mp_crawler.py
Multi-Processes Crawler (in python 2.x version)
# coding=utf-8
# Goal: parse house information for each district from websites
# for each district, get 「土地區段位置或建物區門牌」,「建物型態」,「建物現況格局」,「坪數」,「屋齡」,「總價元」,「資料來源」into csv file
# Procedure:
# 1. get the number of page for each district by parsing first html content
# 2. for each district put all html page together, use htmlparser to parse content and save data into file
import sys
import math
@shihyu
shihyu / sp_crawler.py
Created August 4, 2016 19:28 — forked from laing20333/sp_crawler.py
Single process Crawler (in python 2.x version)
# coding=utf-8
# Goal:
# parse different city's website
# for each city, get 「土地區段位置或建物區門牌」,「建物型態」,「建物現況格局」,「坪數」,「屋齡」,「總價元」,「資料來源」into csv file
# step:
# 1. get number of page by parsing string
# 2. put all html page together, use htmlparser to get content
# 3. parsing content and save it
@shihyu
shihyu / gps.java
Created August 13, 2016 16:16 — forked from javisantana/gps.java
real/fake gps
package hardware;
import java.util.ArrayList;
import android.app.Activity;
import android.content.Context;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.location.LocationProvider;