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
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>cn.mynux.data.statistics</groupId>
<artifactId>feed-data-analysis</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
#/bin/bash
loop=0
sum=0
str=`ls`
arr=($str)
while [ $loop -lt 100 ]; do
res=`wc -l ${arr[$loop]}`
line=`echo $res | cut -d' ' -f1`
echo $line
sum=$(($sum+$line))
@lengerfulluse
lengerfulluse / bash_common_used.md
Last active July 18, 2018 05:58
common used awk command
@lengerfulluse
lengerfulluse / revert_file_in_commit.sh
Created September 6, 2016 09:17
git revert a specific file in a commit script
#!/bin/bash
function output_help {
echo "usage: git-revert-single-file <sha1> <file>"
}
sha1=$1
file=$2
if [[ $sha1 ]]; then
@lengerfulluse
lengerfulluse / aws_command_collection.py
Created September 1, 2016 13:35
common used aws commands collection
# change pem file mode
chmod 400 /path/my-key-pair.pem
# use ssh to login ec2 instance.
ssh -i /path/my-key-pair.pem ec2-user@ec2-198-51-100-1.compute-1.amazonaws.com
#!/usr/bin/python
from __future__ import print_function
import re
def url_mapping():
'''Mapping jekyll like http://t.hengwei.me/post/title/ ---> http://t.hengwei.me/post/title.html'''
with open("lengerfulluse-old.csv", 'r') as fo, open("lengerfulluse-url-mapping.csv", 'w') as fw:
for line in fo:
  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
    
@lengerfulluse
lengerfulluse / css_confusing_features_tips.md
Last active July 21, 2016 08:51
cheatsheet for common used but confusing css properties and features.
@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:
#!/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() {