Skip to content

Instantly share code, notes, and snippets.

View yblee85's full-sized avatar

Yunbo Lee yblee85

  • Toronto, Canada
View GitHub Profile
@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 / 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 / ubuntu - daily backup setup.txt
Created May 23, 2021 01:56
ubuntu / daily backup setup
1. /usr/local/bin/mybackup.sh
#!/bin/bash
#
# couchdb Backup Script
# VER. 0.1
#If it takes a while, Diamond will grab this file and send it to Graphite to graph the duration of the backup.
date > /tmp/backup-couchdb
BASEDIR="/data/couchdb"
BACKUPDIR="/bkp/couchdb"
EXCLUDES="/data/shared/my_excludes.txt"
@yblee85
yblee85 / distance.js
Created January 30, 2020 20:53 — forked from mattpowell/distance.js
Get the distance between two (world) coordinates - a nodejs module
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
/* */
/* Simple node js module to get distance between two coordinates. */
/* */
/* Code transformed from Chris Veness example code - please refer to his website for licensing */
/* questions. */
/* */
/* */
/* Latitude/longitude spherical geodesy formulae & scripts (c) Chris Veness 2002-2011 */
/* - www.movable-type.co.uk/scripts/latlong.html */
@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 / temporary-email-address-domains
Created September 26, 2017 14:52 — forked from adamloving/temporary-email-address-domains
A list of domains for disposable and temporary email addresses. Useful for filtering your email list to increase open rates (sending email to these domains likely will not be opened).
0-mail.com
0815.ru
0clickemail.com
0wnd.net
0wnd.org
10minutemail.com
20minutemail.com
2prong.com
30minutemail.com
3d-painting.com
@yblee85
yblee85 / redis_delete_keys_pattern.sh
Created June 7, 2017 20:53 — forked from JeromeParadis/redis_delete_keys_pattern.sh
Redis: How delete keys matching a pattern?
redis-cli KEYS "prefix:*" | xargs redis-cli DEL
NOTE : First commit your current changes, or you will lose them.
Then run the following commands from the top folder of your git repo:
git rm -r --cached .
git add .
git commit -m "fixed untracked files"
source : http://stackoverflow.com/questions/11451535/gitignore-is-not-working
@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
@yblee85
yblee85 / git_replace_master_with_a_branch.txt
Created April 27, 2016 14:38
Git (replace master with a branch)
// sometimes accidently you switched to a branch and working on it
// and forgot to merge with master for a long long time
// now it would be really difficult to merge with master
// this will basically replace master with a branch
// say, you have a master and a branch named "branch1"
git checkout branch1
git merge -s ours master
git checkout master
git merge branch1