Skip to content

Instantly share code, notes, and snippets.

@xyb
xyb / Perspective: How to pitch your company.md
Last active December 15, 2015 04:10
Perspective: How to pitch your company

SCOTTSDALE, Ariz.--While in the line for the coffee urn at PC Forum, I overheard a young CEO talking about his company.

Apparently, after it became known that Kleiner Perkins Caufield & Byers was interested in investing in the outfit, another venture capital firm, the chief executive said, chartered a private jet to come visit the company to get in on the funding round. "A private jet," he repeated.

The 1990s are back, or at least a shade of them, if you judge by the chatter at the conference here. (PC Forum is owned by CNET Networks, publisher of News.com.)

Two years ago, two young guys with an idea could have more easily raised funds by standing on a bucket and pretending to be robots. Now, investors will fly across the country to discuss doling out cash on the strength of a hunch.

Cat

@xyb
xyb / twister.rb
Created July 7, 2016 03:21
Install twister the p2p microblogging software on mac osx using homebrew
require 'formula'
class Twister < Formula
desc "twister is an experimental peer-to-peer microblogging software."
homepage "http://www.twister.net.co/"
url "https://github.com/miguelfreitas/twister-core/archive/v0.9.34.tar.gz"
sha256 "b250508c7d1c72d1d0dcb2377f65199d1af27e3da9a0f4b4277d818304b101bf"
depends_on "autoconf" => :build
depends_on "automake" => :build
@xyb
xyb / moosefs.rb
Last active July 13, 2016 11:02
Install moosefs on mac osx using homebrew
require "formula"
class Moosefs < Formula
desc "a fault tolerant network distributed file system for petabyte range storage"
homepage "http://moosefs.org/"
url "http://ppa.moosefs.com/src/moosefs-3.0.79-1.tar.gz"
sha256 "f2ddce542c1b2e918060e23e953e220c4a23be982e2bdf214a783f8bac2fb87e"
depends_on "pkg-config" => :build
depends_on "autoconf" => :build
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author: Xie Yanbo <[email protected]>
# Date: 2012-03-21
# see also:
# Unicode Standard Annex #11
# East Asian Width
# http://unicode.org/reports/tr11/
@xyb
xyb / cookiemonster.go
Last active February 3, 2019 15:41 — forked from rwifeng/cookiemonster.go
Simple script to extract (encrypted) cookies out of Chrome OS X cookie store. Usage: ./cookiemonster domain.com
package main
import (
"golang.org/x/crypto/pbkdf2"
"crypto/aes"
"crypto/cipher"
"crypto/sha1"
"database/sql"
"fmt"
"log"
@xyb
xyb / pyinstrument_json_to_flamegraph.py
Created October 31, 2019 08:10
Convert github.com/joerick/pyinstrument's json format to flamegraph
#!/usr/bin/env python3
# Author: Xie Yanbo <[email protected]>
import json
USE_LONG_FILE_PATH = True
def to_flamegraph(pyinst_data):
def walk(data):
@xyb
xyb / cdctool.py
Created February 28, 2020 06:03
A tool help to compare huge files by splitting them into small content-based chunks.
#!/usr/bin/env python3
# Usage: python3 cdctools.py <data_file> [<chunk_size>]
# Usage: MORE_DETAILS=1 python3 cdctools.py <data_file> [<chunk_size>]
import os
import sys
import fastchunking
READ_BUFFER_SIZE = 1024 * 4
from datetime import datetime
def format_local_datetime(dt):
"""Return a string with local timezone representing the date."""
try:
return dt.astimezone().strftime('%Y-%m-%d %H:%M %z')
except (TypeError, ValueError):
# Python 2 do not have builtin timezone
import time
def get_timezone_offset():
@xyb
xyb / sqlite-kv-restful.py
Last active July 1, 2020 04:10 — forked from georgepsarakis/sqlite-kv-restful.py
Simple SQLite-backed key-value storage Rest API. Built with Flask & flask-restful.
#!/usr/bin/env python3
"""
Requirements:
pip install Flask==1.1.2 Flask-RESTful==0.3.8
"""
import os
import sqlite3
@xyb
xyb / docker-save.sh
Created July 2, 2020 08:06
save docker image to a compressed tar ball
#!/bin/sh
image="$1"
tarfile=$(echo "$image" | sed -e 's:/:--:g' -e 's/$/.tar/')
tgzfile=$(echo "$tarfile" | sed -e 's/$/.gz/')
docker save "$image" -o "$tarfile"
gzip "$tarfile"
echo "$image" saved to "$tgzfile"