Skip to content

Instantly share code, notes, and snippets.

View zlsun's full-sized avatar

zlsun zlsun

  • China
View GitHub Profile
@zlsun
zlsun / common.mk
Last active August 29, 2015 14:05
Common Makefile for simple C/C++ project
# project directories
# project_dir := $(shell pwd)
include_dir := ./include
src_dir := ./src
lib_dir := ./lib
build_dir := ./build
# targets
targets := main
targets := $(foreach t, $(targets), $(t).exe)
@zlsun
zlsun / Translate indent to 2 space.sublime-macro
Created March 15, 2015 07:20
A helpful Sublime Text marco that translate indent to 2 space.
[
{
"args": {
"set_translate_tabs": true
},
"command": "unexpand_tabs"
},
{
"command": "set_setting",
"args": {
@zlsun
zlsun / Translate indent to 4 space.sublime-macro
Created March 15, 2015 07:22
A helpful Sublime Text marco that translate indent to 4 space.
[
{
"args": {
"set_translate_tabs": true
},
"command": "unexpand_tabs"
},
{
"command": "set_setting",
"args": {
@zlsun
zlsun / ignorelist
Last active August 29, 2015 14:27 — forked from rubo77/ignorelist
This ignorelist can be used to backup your home folder without useless folders and files, see http://askubuntu.com/a/545676/34298
#These directories may be excluded:
# contains mounted file systems
.gvfs
.local/share/gvfs-metadata
# contains the actual encrypted home directory
.Private
# session-specific
.dbus
.cache
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import os
import requests
from path import Path
from sh import git
user = 'your username'
@zlsun
zlsun / run-py-file-with-python2.sh
Last active December 25, 2015 09:04
The correct way to run py file with python2.
#!/usr/bin/env bash
SCRIPTPATH=`dirname "${BASH_SOURCE[0]}"`
cd "$SCRIPTPATH"
PYTHON=python
if hash python2 > /dev/null 2>&1; then
PYTHON=python2
fi
#include <iostream>
#include <iomanip>
#include "date.h"
using namespace std;
using namespace date;
using namespace std::chrono;
int main(int argc, char *argv[])
@zlsun
zlsun / vimura.md
Created January 11, 2016 13:04 — forked from vext01/vimura.md
Vim+Zathura+Synctex

Vim+Zathura+Synctex

  • In a script called 'vimura':
#!/bin/sh
echo $1
zathura -s -x "gvim --servername $1 -c \"let g:syncpdf='$1'\" --remote +%{line} %{input}" $*
@zlsun
zlsun / fix-zip
Last active January 12, 2016 06:55
Fix mojibake zip file
#!/usr/bin/env bash
if [ $# -eq 0 ]; then
echo "Usage: $0 zip-file-to-fix"
exit
fi
log() {
printf "\e[1;31m[%s]\e[0m\t%s\n" "$1" "$2"
}

Usage

  1. npm install babel-loader imports-loader webpack --save
  2. Create webpack.config.js
  3. Move index.ios.js to src/index.ios.jsx
  4. webpack --watch

Example

src/index.ios.jsx