Skip to content

Instantly share code, notes, and snippets.

View bcho's full-sized avatar
💍
一起来发财吧!Let's make some money!

hbc bcho

💍
一起来发财吧!Let's make some money!
View GitHub Profile
use std::collections::HashMap;
use std::string::String;
fn main() {
let mut candidates: HashMap<String, int> = HashMap::new();
let pow = |num: int| { num * num * num };
let sorted_str = |s: String| {
let mut v = Vec::new();
for i in s.as_slice().chars() {
#!/bin/bash
BROWSE_URL='http://simpledesktops.com/browse/'
MATCH_PATTERN='http\:\/\/static\.simpledesktops\.com\/uploads\/desktops\/.*\.[0-9]*x[0-9]*_q100\.png'
OUTPUT_FILENAME='wallpaper.png'
curl $BROWSE_URL | grep -Po $MATCH_PATTERN | cut -d '.' -f 1-4 | head -1 | xargs curl -o $OUTPUT_FILENAME

Sample:

1------2-------3----------4-------5--------6--------7
                          XX                        |
                           XX                       |
                            XX                      |
                             XX                     |
                              X---10--------9-------8
// ==UserScript==
// @name GDUT 教务管理系统 helper
// @namespace http://use.i.E.your.homepage/
// @version 0.1
// @description better experience on gdut jwgl system
// @match http://jwgl.gdut.edu.cn/*
// @match http://jwgldx.gdut.edu.cn/*
// @match http://222.200.98.201/*
// @match http://222.200.98.204/*
// @match http://222.200.98.205/*
#name "test.cl"
#5 CLASS
#5 TYPEID CellularAutomaton
#5 INHERITS
#5 TYPEID IO
#5 '{'
#6 OBJECTID population_map
#6 ':'
#6 TYPEID String
#6 ';'
@bcho
bcho / nfa_re.py
Created August 15, 2014 14:38
A small nfa regex express engine written in Python.
# coding: utf-8
'''
Support operations:
- character match
- seq
- or
- repeatition
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>HTTP Verbs Test</title>
</head>
<body>
<section class="verb">
<header>
<h3 class="name">GET</h3>
-- checking for one of the modules 'sdl2'
CMake Error at /usr/share/cmake-3.0/Modules/FindPkgConfig.cmake:425 (message):
None of the required 'sdl2' found
Call Stack (most recent call first):
CMakeLists_mingw.txt:29 (PKG_SEARCH_MODULE)
/usr/share/cmake-3.0/Modules/CMakeDetermineSystem.cmake:95 (include)
CMakeLists.txt:24 (project)
-- checking for one of the modules 'sdl2'
body {
background: #000;
}
#app-canvas {
margin: 0;
padding: 0;
}
int mouseClickedCount = 0;
float mouseLastClickedTimeMS = 0;
Circle[] circles = new circles[100];
int circleIdx = -1;
boolean dragging = false;
int draggingCircleIdx = -1;
float draggingOffsetX = 0.0;
float draggingOffsetY = 0.0;