Skip to content

Instantly share code, notes, and snippets.

@starlightme
starlightme / douban_comment.rb
Created April 3, 2017 06:52 — forked from marshluca/douban_comment.rb
豆瓣自动顶贴
require 'rubygems'
require 'mechanize'
def comment_douban_topic(url,text)
login_url = "http://www.douban.com/login"
agent = Mechanize.new
# agent.set_proxy("218.201.21.176","80")
agent.user_agent_alias = "Googlebot"
page = agent.get(login_url)
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# mainly for sql query
filename = 'test.txt'
with open(filename,'r') as fp:
l = fp.readlines()
@starlightme
starlightme / Typography cheat sheet
Created February 12, 2016 11:46 — forked from richardcornish/typography.md
These character sets are not exhaustive, but merely a quick reference for common characters.
These character sets are not exhaustive, but merely a quick reference for common characters.
Quotation
‘ ‘ \2018 Open single quotation mark
’ ’ \2019 Closed single quotation mark / Apostrophe
“ “ \201C Open double quotation mark
” ” \201D Closed double quotation mark
' ' \0027 Typewriter single quotation mark
" " \0022 Typewriter double quotation mark
′ ′ \2032 Prime (Feet / Minutes)
@starlightme
starlightme / str2int.pde
Created November 27, 2015 08:09
Convert string to int in processing
void setup()
{
String s = "12";
int i = parseInt(s);
println(s+1);
println(i+1);
}
@starlightme
starlightme / serial.ino
Created November 26, 2015 14:41
receive serial data and plot
int i;
void setup(){
Serial.begin(9600);
}
void loop(){
i++;
Serial.write(150 + i);
delay(1000);
}
@starlightme
starlightme / bobp-python.md
Created November 8, 2015 14:42 — forked from sloria/bobp-python.md
A "Best of the Best Practices" (BOBP) guide to developing in Python.

The Best of the Best Practices (BOBP) Guide for Python

A "Best of the Best Practices" (BOBP) guide to developing in Python.

In General

Values

  • "Build tools for others that you want to be built for you." - Kenneth Reitz
  • "Simplicity is alway better than functionality." - Pieter Hintjens
@starlightme
starlightme / nesign.py
Created November 1, 2015 03:17 — forked from abrasumente233/nesign.py
网易云音乐签到(pc android)
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import logging
import requests
'''
A module for helping you to finish the daily task on Neteasy Music
'''
@starlightme
starlightme / button.cs
Created October 15, 2015 14:54
串口通讯 -- 上位机端
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication2
@starlightme
starlightme / button.ino
Last active October 15, 2015 14:54
串口通信-- Arduino端
void setup()
{
Serial.begin(9600);
pinMode(13, OUTPUT);
digitalWrite(13, HIGH);
}
int led = 1;
void loop()
@starlightme
starlightme / example.py
Last active August 29, 2015 14:18
字符串和列表的一种使用
string = '12345'
L = []
for i in string:
i += ' '
L.append(i)
string = ''.join(L)
#重写一下,这样更短也更快
string = '12345'
L = [i + ' ' for i in string]