Skip to content

Instantly share code, notes, and snippets.

View yblee85's full-sized avatar

Yunbo Lee yblee85

  • Toronto, Canada
View GitHub Profile
{
"analyzer": "class org.apache.lucene.analysis.standard.StandardAnalyzer",
"etag": "136aa9854e3df",
"fetch_duration": 0,
"limit": 31,
"plan": "BooleanQuery(TermQuery(desc_upc_cat_sup:koka,boost=1.0)+TermQuery(default:kola,boost=1.0)+TermQuery(locid:88c6b2ca7d76cc613907149e505c5eff,boost=1.0),boost=1.0)",
"q": "desc_upc_cat_sup:koka +default:kola +locid:88c6b2ca7d76cc613907149e505c5eff",
"rows": [],
"search_duration": 0,
"skip": 0,
@yblee85
yblee85 / gist:0614f3021d21e2d47139
Created January 8, 2015 23:24
FIx git error : object file is empty
error like this
error: object file .git/objects/31/65329bb680e30595f242b7c4d8406ca63eeab0 is empty
fatal: loose object 3165329bb680e30595f242b7c4d8406ca63eeab0 (stored in .git/objects/31/65329bb680e30595f242b7c4d8406ca63eeab0) is corrupt
here you go.
Step 1: Make a backup of .git (in fact I do this in between every step that changes something, but with a new copy-to name, e.g. .git-old-1, .git-old-2, etc.):
@yblee85
yblee85 / gist:832b82999a00768c28e7
Last active March 16, 2016 20:37
Install CouchDB 1.6.1 on Ubuntu 14.04 (origin : pixelpark/ppnet)
# via http://wiki.apache.org/couchdb/Installing_on_Ubuntu
sudo apt-get install --yes build-essential curl git
sudo apt-get install --yes python-software-properties python g++ make
sudo apt-get install -y erlang-dev erlang-manpages erlang-base-hipe erlang-eunit erlang-nox erlang-xmerl erlang-inets
sudo apt-get install -y libmozjs185-dev libicu-dev libcurl4-gnutls-dev libtool
# via http://ftp.fau.de/apache/couchdb/source/1.6.1/
cd /tmp
@yblee85
yblee85 / gist:fe57ed6e32c8d102d365
Last active August 29, 2015 14:13
creating service in ubuntu 12.04
// origin : askubuntu.com (http://askubuntu.com/questions/351879/how-to-create-a-service-on-ubuntu-lts-12-04)
// about upstart manual : http://upstart.ubuntu.com/cookbook
Upstart scripts have to placed at /etc/init, ending with .conf.
Basically they require 2 sessions: one to indicate when to start, and another with the command to exec.
The easiest script to start with your sample is:
# myprogram.conf
@yblee85
yblee85 / GzipTest.java
Last active January 11, 2024 12:50
java gzip convert string to gzip / gzip to string
package gzip;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.InputStreamReader;
import java.util.zip.GZIPInputStream;
import java.util.zip.GZIPOutputStream;
public class GzipTest {
@yblee85
yblee85 / increase_number_of_max_open_files
Created May 27, 2015 16:50
Ubuntu, Increase number of max open files
edit /etc/security/limits.conf
# non-root users
* soft nofile 40000
* hard nofile 40000
# root users
root soft nofile 40000
root hard nofile 40000
@yblee85
yblee85 / gist:50da5b708b7c7470762c
Created September 17, 2015 16:20
Bootable USB from directory in Windows
//command line
diskpart
//diskpart command line
list disk
//it will show disk
// disk0, 1, 2
select disk 2
clean
@yblee85
yblee85 / includeCSS.js
Created September 23, 2015 21:47
include CSS file / add new CSS
function includeCSSfile(href) {
var head_node = document.head || document.getElementsByTagName('head')[0];
var link_tag = document.createElement('link');
link_tag.setAttribute('rel', 'stylesheet');
link_tag.setAttribute('type', 'text/css');
link_tag.setAttribute('href', href);
head_node.appendChild(link_tag);
}
@yblee85
yblee85 / updateFavicon.js
Created September 23, 2015 21:48
update favicon dynamically
function updateFavicon(faviconURL) {
var src = faviconURL;
var head_node = document.head || document.getElementsByTagName('head')[0];
var link = document.createElement('link'),
oldLink = document.getElementById('favicon');
link.id = 'favicon';
link.rel = 'shortcut icon';
link.href = src;
if (oldLink) {
head_node.removeChild(oldLink);
@yblee85
yblee85 / readme.txt
Created October 22, 2015 17:24
Create Bootable USB from directory in Windows
//command line
diskpart
//diskpart command line
list disk
//it will show disk
// disk0, 1, 2
select disk 2
clean