Skip to content

Instantly share code, notes, and snippets.

View starrify's full-sized avatar

Peng-Yu Chen starrify

  • Zyte (Formerly Scrapinghub)
  • Ireland
View GitHub Profile

Testing code:

#include <stdio.h>
#include <string.h>
#include <assert.h>

/*
 * Implements http://stackoverflow.com/a/25541929/466611
 */

static inline unsigned int test1(int n)

@starrify
starrify / vec_add_test.cu
Created May 27, 2014 14:38
a simple sample of a CUDA C program for Duan Dinglong
/*
* This is a simple sample of a CUDA C program for Duan Dinglong,
* By Pengyu CHEN (pengyu[at]libstarrify.so)
* COPYLEFT, ALL WRONGS RESERVED.
*
* usage: nvcc vec_add_test.cu && time ./a.out GPU 1000000
*/
#include <cuda.h>
@starrify
starrify / PKGBUILD
Created April 2, 2014 12:05
A working PKGBUILD for python2-recaptcha-client. See https://aur.archlinux.org/packages/python2-recaptcha-client/
# Contributor: Peter Baldwin <bald_pete@hotmail.com>
# Contributor: Eduardo Robles Elvira <edulix AT gmail DOT com>
# Contributor: Pengyu CHEN <cpy.prefers.you[at]gmail.com>
pkgname=python2-recaptcha-client
pkgver=1.0.6
pkgrel=1
pkgdesc="Provides a CAPTCHA for Python using the reCAPTCHA service"
license="MIT"
url="http://pypi.python.org/pypi/recaptcha-client"
#!/usr/bin/env python2
#-*- coding:utf-8 -*-
# This is solver for problem passcode in BCTF2014
# See http://bctf.cn/problems/4
# By Pengyu CHEN (cpy.prefers.you[at]gmail.com)
# COPY LEFT, ALL WRONGS RESERVED.
import base64
import binascii
@starrify
starrify / gist:5993392
Created July 14, 2013 06:33
...a simple LED controller
/*
Button
Turns on and off a light emitting diode(LED) connected to digital
pin 13, when pressing a pushbutton attached to pin 2.
The circuit:
* LED attached from pin 13 to ground
* pushbutton attached to pin 2 from +5V
@starrify
starrify / intro2stpl
Created June 4, 2013 13:36
关于SimpleTemplate Engine的一点简介. for Zhu Mengying
文档参见 http://bottlepy.org/docs/dev/stpl.html
如下是那个SimpleTemplageEngine的一个示例
如下文件被保存在template/flight/oneway.tpl 其中单个百分号开头的行是内嵌的python代码
----start of template/flight/oneway.tpl-------
Oneway flight~<br>
<div id="flights">
%if flights:
% for item in flights:
<div><strong>{{item['fn']}}</strong> : {{item}}</div>