Skip to content

Instantly share code, notes, and snippets.

View peter50216's full-sized avatar
🎶
🐰

Peter Shih peter50216

🎶
🐰
View GitHub Profile
@peter50216
peter50216 / __init__.py
Created May 5, 2016 08:01
Calibre: import book with dir name plugin.
import os.path
import textwrap
import os
import glob
from calibre.customize import FileTypePlugin, MetadataReaderPlugin, MetadataWriterPlugin
from calibre.constants import numeric_version
class FileDirMetadataReader(MetadataReaderPlugin):
name = 'FileDir metadata'
#!/bin/sh
sudo apt-get update
sudo apt-get install git zsh
@peter50216
peter50216 / pietty_set_defaults.rb
Last active January 29, 2016 06:42
Set settings for all putty/pietty profile at once.
require 'win32/registry'
access = Win32::Registry::KEY_ALL_ACCESS
defaults = [
['TerminalType', 'xterm-256color'],
['CloseOnExit', 1],
['WarnOnClose', 0],
['LinuxFunctionKeys', 2],
]
#include <cstdio>
#include <cstring>
#include <cassert>
const int n = 686;
const char *str="10101011000111011010101100011101101011000001110110101100000110101010110111000110110111011010110110110110110000000000011010101011011100011100000000011101101011011101110111011011011101110110101010101010101011000110110110110000000111011101101101101101110110101100000001110111011101101010110001101101101101101011000001110001101010110001110001101101101011011011011010110110110110101010110111011011011011000111000000011101110111000111000111000000000111011100011100011100011101101101110111000110110111011010101011000000011010101101101100000111011100000110110110110111000110101011000000000110110110101011000000000110101010110110101010110110101010101101110111000111000001110000011010110110110001";
int c[n+1];
int A[n+1][n+1];
cur_label = ''
cur_func = ''
in_select_val = false
is_state_table = false
in_list = false
require 'set'
#!/usr/bin/env ruby
require 'mechanize'
m = Mechanize.new
loop do
cmd = gets.strip
s = 1
io = require('socket.io-client')
s = io('http://coffeeio.9447.plumbing/')
order =
type: 'piccolo'
size: 'small'
milk: 'soy'
decaf: false
orange: false
caramel: false
require 'zocket' # custom socket wrapper.
ans = '9447{'
CHARS = '_'.chars+('a'..'z').to_a+('A'..'Z').to_a+('0'..'9').to_a+' },'.chars
while ans.size < 285
l = ans.size + 1
puts ans
CHARS.each do |c|