Skip to content

Instantly share code, notes, and snippets.

View billie66's full-sized avatar
🏠
Working from home

Billie Zhang billie66

🏠
Working from home
View GitHub Profile
Verifying my Blockstack ID is secured with the address 1A27dCp2zWG6SAoQpQRWbXUHSZeVa1C7XZ https://explorer.blockstack.org/address/1A27dCp2zWG6SAoQpQRWbXUHSZeVa1C7XZ
@billie66
billie66 / bongo.sh
Created November 22, 2016 14:28 — forked from nhoening/bongo.sh
Allowing to pass a query for exporting specific data. Added a LIMIT option to limit the number of returned results. Added a debug switch to see errors.
#!/bin/bash
LOADING=false
DEBUG=/dev/null
usage()
{
cat << EOF
usage: $0 [options] <DBNAME>
@billie66
billie66 / tmux-cheatsheet.markdown
Created September 13, 2016 03:37 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
# encoding: UTF-8
# happycasts database
namespace :db do
desc "get episods' info from the table episods"
task :episodes => :environment do
posts = []
Episode.all.each do |e|
post = {}
post['id'] = e.id
# encoding: UTF-8
namespace :db do
desc "import some data to the users table"
task :users => :environment do
a = []
File.open("lib/tasks/talk_production.sql", 'r') do |f|
a = f.read.strip.split(/\n/)
end
a.delete_at(0)
a.each do |e|
// 1. How to check if one array has all elements of another?
var importedEmails = ['[email protected]', '[email protected]'],
existingEmails = ['[email protected]', '[email protected]', '[email protected]'];
if(!_.difference(importedEmails, existingEmails).length) console.log('already imported')
// > already imported
// **********************************************************
// 2. How to find what elements are common to two arrays?
# encoding: utf-8
str = ''
File.open("tasks.md", 'r') do |f|
str = f.read
end
str = str.gsub(/^###\s?(.*?)\s?$/, "<h3>\\1</h3>\n").
gsub(/^任务:\s?(.*?)\n$/, "<div>\n<h3>\\1</h3>\n<ul>").
gsub(/^\-\s+视频:\s?(.*?)$/, "</ul>\n<a href='\\1'>视频</a>\n</div>\n").
#!/usr/bin/env bash
on_die() {
echo+
echo byebye proxy
echo+
networksetup -setsocksfirewallproxystate "Ethernet 2" off #close the proxy+
}
@billie66
billie66 / index.rb
Last active August 29, 2015 14:08
deal with file names, like 001-git-revert.md, to make a content for all of files
# encoding: utf-8
def html(num, sname, fname, token)
str = <<-EOF
<tr class="episode-wrap#{token}">
<td class="episode-index">#{num}</td>
<td class="episode-title">
<a href="#{fname}">#{sname}</a>
</td>
</tr>
@billie66
billie66 / getnote.rake
Last active August 29, 2015 14:08
get the notes of every episode from the episodes table
# encoding: UTF-8
namespace :db do
desc "get all of the notes from episodes table"
task :episodes => :environment do
def header(name)
str = <<-EOF.gsub(/^\s{6}/, '')
---
layout: post
title: #{name}
---