Skip to content

Instantly share code, notes, and snippets.

@c3h3
c3h3 / fib.py
Last active December 23, 2020 10:14
from itertools import islice, imap, tee
from operator import add
def tail(iterable):
return islice(iterable, 1, None)
def take(n, iterable):
return list(islice(iterable, 0, n))
def fibs():
import werobot
robot = werobot.WeRoBot(token='')
@robot.handler
def echo(message):
return 'Hello World!'
robot.config['HOST'] = '0.0.0.0'
import requests
from pyquery import PyQuery
url = "https://cn.shopbop.com/sale-bags/br/v=1/15355.htm "
res =requests.get(url)
S = PyQuery(res.text)
S("[data-productid]").map(lambda i,e: PyQuery(e).attr("data-productid"))
@c3h3
c3h3 / gist:71a413de75efd40726e9e6e567bdb33c
Created January 3, 2018 16:24 — forked from allex/gist:11203573
Ubuntu 安装中文字体

环境 (Environment)

版本:Ubuntu 14.04 LTS 默认语言:English(United States)

安装 (Setup)

Debian 和 Ubuntu 下对中文支持比较好的字体有: fonts-droid、ttf-wqy-zenhei 和 ttf-wqy-microhei 等,除了文泉驿系列字体外,比较流行的免费中文字体还有文鼎提供的楷体和上海宋,包名分别是: fonts-arphic-ukai 和 fonts-arphic-uming。

@c3h3
c3h3 / slides
Created September 8, 2017 07:07
{
"cells": [
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"source": [
{
"cells": [
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"source": [
@c3h3
c3h3 / fib.sql
Created September 6, 2017 19:11 — forked from hden/fib.sql
Fibonacci numbers with SQLite
-- http://www.sqlite.org/lang_with.html --
WITH RECURSIVE
fib(current, next) AS (
SELECT 0 current, 1 next
UNION ALL
SELECT fib.next current, fib.current + fib.next next
FROM fib
LIMIT 20
)
SELECT current FROM fib
<html>
<head>
<link rel="stylesheet" type="text/css" href="../static/css/site.css">
<title>{{title}}</title>
</head>
<body>
<h2>{{text.content}}!</h2>
<ul>
{% for text in data %}
<li>
library(quantstrat)
library(magrittr)
Xt = getSymbols('2498.TW', auto.assign = F)
# 1st Step: Attach MA indicators onto symbol
Xt$MA5 = Xt %>% Cl %>% SMA(5)
Xt$MA60 = Xt %>% Cl %>% SMA(60)
library(httr)
library(rvest)
library(XML)
library(testit)
library(magrittr)
# origin="TPE"
# destination="SEA"
getAirlineCode <- function(origin="TPE", destination="SEA") {