Skip to content

Instantly share code, notes, and snippets.

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

Wei Heng lengerfulluse

🏠
Working from home
View GitHub Profile
@lengerfulluse
lengerfulluse / common_used_keytoll_cmd.md
Last active August 29, 2015 14:22
Common used java security certificate create/modify command(openssl, keytool)

####keytool

  1. To Create a New TrustStore
    keytool -import -file C:\cascerts\firstCA.cert -alias firstCA -keystore myTrustStore

  2. To import a cert to a trustStore:
    eytool -import -trustcacerts -file cacert.pem.cer -alias tenpay_ca -keystore wechat-cert.ssl.truststore.jks

  3. List a certs in a trustStore:
    keytool -list -v -keystore $JAVA_HOME/jre/lib/security/cacerts

@lengerfulluse
lengerfulluse / fixing_of_gitignore_not_working.md
Last active August 29, 2015 14:22
fixing for gitignore not working
  1. To untrack a single file that has already been added/initialized to your repository, i.e., stop tracking the file but not delete it from your system use:

      git rm --cached filename .
    
  2. To untrack every file that is now in your .gitignore:
    a. First commit any outstanding code changes, and then, run this command:

    git rm -r --cached .

b. This removes any changed files from the index(staging area), then just run:

@lengerfulluse
lengerfulluse / ruby_filter_with_CJK_character.md
Last active August 29, 2015 14:22
Ruby filter CJK characters
@lengerfulluse
lengerfulluse / BaiduSpider_crawler_check.sh
Created July 29, 2015 03:26
use this command to check whether a site can be crawled successfully.
curl -A "Mozilla/5.0 (compatible; Baiduspider/2.0; +http://www.baidu.com/search/spider.html)" http://t.hengwei.me
@lengerfulluse
lengerfulluse / homebrew-github-api-token.md
Created December 21, 2015 05:38 — forked from christopheranderton/homebrew-github-api-token.md
Set your Github API Token If you hit a ”GitHub API rate limit exceeded” when searching with Homebrew (http://brew.sh/).

Description

When using Homebrew (http://brew.sh) and searching formulas or pull requests you may get the dreaded error message: Github API Rate limit exceeded

Let's fix that! (yeah!)


Short version

Create a new Personal Token in your Github Account Settings (Sidebar: Applications) and then copy the Token. In the Terminal, use export HOMEBREW_GITHUB_API_TOKEN=YOURAPITOKENWITHFUNKYNUMBERSHERE (change that to your API Token) or add that to your .bash_profile and then do source .bash_profile.

@lengerfulluse
lengerfulluse / disqus_comment_api
Created December 23, 2015 14:48
Get Disqus Comment for a thread:link
https://disqus.com/api/console/?endpoint=threads%2FlistPosts#!/?account=3957037&access=secret&method=GET&endpoint=threads%2FlistPosts&format=json&forum=lengerfulluse&thread%3Alink=http%3A%2F%2Ft.hengwei.me%2Fpost%2F%25E4%25B9%259F%25E8%25B0%2588MCMC%25E6%2596%25B9%25E6%25B3%2595%25E4%25B8%258EGibbs%25E6%258A%25BD%25E6%25A0%25B7%2F&op=request&csrfmiddlewaretoken=m8CkYeahLsfxHrdWy1c9maWkIQASpU7h
#!/bin/bash
# where to store the sparse-image
WORKSPACE=~/UnixVolume.dmg.sparseimage
create() {
hdiutil create -verbose -type SPARSE -fs 'Case-sensitive Journaled HFS+' -size 50g -volname UnixVolume ${WORKSPACE}
}
detach() {
@lengerfulluse
lengerfulluse / remote_deploy_with_git_bare_repo.txt
Created July 18, 2016 09:11
Deploy to DigitalOcean with git bare repo hooks
REFER LINK: https://www.digitalocean.com/community/tutorials/how-to-deploy-jekyll-blogs-with-git.
apt-get install git-core
Second, change to your home directory and create a new "bare repository" to deploy to.
cd ~/
mkdir repos && cd repos
mkdir awesomeblog.git && cd awesomeblog.git
git init --bare
Following that, we need to set up a post-receive hook. This is a shell script that Git runs when files are pushed to a repository. Create it like so:
@lengerfulluse
lengerfulluse / css_confusing_features_tips.md
Last active July 21, 2016 08:51
cheatsheet for common used but confusing css properties and features.
  1. install ipython notebook. pip3 install jupyter

  2. install tensorflow on virtualenv.

     `$ sudo pip install --upgrade virtualenv`
     `$ virtualenv --system-site-packages ~/tensorflow`   
     `$ source ~/tensorflow/bin/activate  # If using bash