Skip to content

Instantly share code, notes, and snippets.

@lifuzu
lifuzu / .gitconfig
Created March 11, 2014 17:09
Three levels of GIT config
# There are 3 levels of git config; project, global and system.
# project: Project configs are only available for the current project and stored in .git/config in the project's directory.
# global: Global configs are available for all projects for the current user and stored in ~/.gitconfig.
# system: System configs are available for all the users/projects and stored in /etc/gitconfig.
# Create a project specific config, you have to execute this under the project's directory.
$ git config user.name "John Doe"
# Create a global config
@lifuzu
lifuzu / sysctl.log
Created March 9, 2016 22:21
sysctl log on mac osx for evaluation python and nodejs
$ sysctl -A
user.cs_path: /usr/bin:/bin:/usr/sbin:/sbin
user.bc_base_max: 99
user.bc_dim_max: 2048
user.bc_scale_max: 99
user.bc_string_max: 1000
user.coll_weights_max: 2
user.expr_nest_max: 32
user.line_max: 2048
user.re_dup_max: 255
@lifuzu
lifuzu / helloworld.dex.md
Created April 1, 2014 17:10
execute the dex file in android with command
public class HelloWorld {
    public static void main(String[] args) {
         System.out.println("Hello World!");
    }
}

To run it on an android device:

javac HelloWorld.java

Merging Rubygems and Bundler

1.sh:

#!/bin/sh
set -eux
rm -rf rubygems bundler
git clone https://github.com/rubygems/rubygems
git clone https://github.com/rubygems/bundler
@lifuzu
lifuzu / auto_update.md
Created April 3, 2014 17:10
Android auto update apk implementation
public class UpdateApp extends AsyncTask<String,Void,Void>{
private Context context;
public void setContext(Context contextf){
    context = contextf;
}

@Override
protected Void doInBackground(String... arg0) {
      try {
@lifuzu
lifuzu / hello_world.script
Created October 4, 2013 20:46
Remove duplicates email from Outlook
tell application "Finder"
display dialog "hello world!"
end tell
@lifuzu
lifuzu / git_submodule.bash
Last active September 14, 2022 06:17
Display git submodule history
# Display git history including/interleave submodule commits
$ git log -1 -p --submodule
# Refereneces:
# http://stackoverflow.com/questions/8843724/git-history-including-interleave-submodule-commits
# http://git-scm.com/docs/git-submodule
@lifuzu
lifuzu / invoke_curl.groovy
Created April 18, 2014 19:19
using groovy to invoke curl
// Define cURL process with correct arguments.
def proc = "curl -o log/${day.format('yyyy-MM-dd')}.log "
+ "http://servername/import-data/${day.format('yyyy-MM-dd')}"
.execute()
// cURL uses error output stream for progress output.
Thread.start { System.err << proc.err }
// Wait until cURL process finished and continue with the loop.
proc.waitFor()
@lifuzu
lifuzu / build.gradle
Created December 12, 2013 05:23
Parse XML file in gradle
//Declaring the inputs and outputs of a task
//build.gradle
task transform {
ext.srcFile = file('mountains.xml')
ext.destDir = new File(buildDir, 'generated')
inputs.file srcFile
outputs.dir destDir
doLast {
println "Transforming source file."
#!/bin/sh
# From Gerrit Code Review 2.5-rc0
#
# Part of Gerrit Code Review (http://code.google.com/p/gerrit/)
#
# Copyright (C) 2009 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at