Skip to content

Instantly share code, notes, and snippets.

View zilongshanren's full-sized avatar
🎯
Focusing

子龙山人 zilongshanren

🎯
Focusing
View GitHub Profile
@zilongshanren
zilongshanren / git-export-changes-between-two-commits.md
Created March 28, 2019 01:15 — forked from mrkpatchaa/git-export-changes-between-two-commits.md
Git command to export only changed files between two commits

Use case : Imagine we have just created a project with composer create-project awesone-project (currently V0.2). 2 weeks later, there is a new release (V0.3). How to update your project ? Since composer update only updates the project dependencies, it is not what we are looking for. Composer doesn't know about awesome-project since it's not in our composer.json.

After trying many git solutions, I've come to this :

git archive --output=changes.zip HEAD $(git diff --name-only SHA1 SHA2 --diff-filter=ACMRTUXB)

This command will check for changes between the two commits and ignore deleted files.

@zilongshanren
zilongshanren / .dir-locals.el
Created November 21, 2018 01:45 — forked from cosven/.dir-locals.el
Emasc Python 项目 .dir-locals.el 示例
((python-mode
;; 激活 pyvenv-mode,也可以自己在 init.el 中默认激活
(eval . (pyvenv-mode))
;; 这个要写绝对路径
(pyvenv-activate . "/Users/cosven/projectpath/.venv")
;; 默认 select python-pylint 这个 checker
;;
@zilongshanren
zilongshanren / git tutorials.md
Created November 20, 2018 08:45 — forked from jaseemabid/git tutorials.md
Awesome git tutorials I am finding here and there
@zilongshanren
zilongshanren / arch_vbox.md
Created November 10, 2018 06:26 — forked from dannycastonguay/arch_vbox.md
Installing Arch Linux on VirtualBox in Windows 10 for beginners

Installing Arch Linux on VirtualBox in Windows 10

I recently upgraded to a new system, and instead of running Arch Linux natively I've decided to run it inside VirtualBox on Windows 10. Below I note down the steps I took, which closely follow the excellent wiki pages of archlinux. But along the way, I also noted a few other steps steps I took to make this system very comfortable, which you'll have to figure out for yourself if you like them or not!

Setting up Windows 10 to be ready

There isn't much of preparation required, given that I started from scratch, but I did have to setup my windows environment a little bit.

  1. Install the windows package manager chocolatey
  2. Install qBittorrent (which will be used to download an iso copy of arch) by running the following command from the command line choco install qbittorrent (recommended to run the command line as an adm
@zilongshanren
zilongshanren / inference.md
Created December 13, 2016 02:00 — forked from swannodette/inference.md
Externs Inference

Externs Inference

Integrating third party JavaScript libraries not written with Google Closure Compiler in mind continues to both be a source of error for users when going to production, and significant vigilance and effort for the the broader community (CLJSJS libraries must provide up-to-date and accurate externs).

In truth writing externs is far simpler than most users imagine. You only need externs for the parts of the library you actually intend to use from ClojureScript. However this isn't so easy to determine from Closure's own documentation. Still in the process of writing your code it's easy to miss a case. In production you will see the much dreaded error that some mangled name does not exist. Fortunately it's possible to enable some compiler flags :pretty-print true :pseudo-names true to generate an advanced build with human readable names. However debugging missing externs means compiling your production build for each missed case. So much time wasted for such simple mistakes damages our sen

git config --global https.proxy http://127.0.0.1:1080
git config --global https.proxy https://127.0.0.1:1080
git config --global --unset http.proxy
git config --global --unset https.proxy
npm config delete proxy
@zilongshanren
zilongshanren / planck-dependency.md
Created August 4, 2016 02:12 — forked from borkdude/planck-dependency.md
Fast REPL session with a cljs library using Planck

Get a fast starting REPL session with a ClojureScript library using Planck.

This is a draft of what will be eventually a blog post. Feedback is welcome.

It started by asking this question on StackOverflow. A good answer turned out to be Planck. This is how you solve it with Planck.

First, decide what dependencies Planck needs to load. This is easily done with boot like this:

$ boot --dependencies org.clojars.micha/boot-cp        ; load with-cp task that helps exporting minimal classpath to file

--dependencies com.andrewmcveigh/cljs-time:"0.4.0" ; load dependency you actually want to try

@zilongshanren
zilongshanren / renew-certs
Created July 30, 2016 08:40 — forked from jonaharagon/renew-certs
Auto Renewal Script for Let's Encrypt and Discourse (@ DigitalOcean)
#!/bin/bash
web_service='nginx'
config_file="/opt/letsencrypt/settings.ini"
le_path='/opt/letsencrypt'
exp_limit=30;
if [ ! -f $config_file ]; then
echo "[ERROR] config file does not exist: $config_file"
@zilongshanren
zilongshanren / Clojure_on_RaspberryPi_OSX.md
Created June 20, 2016 08:20 — forked from akiatoji/Clojure_on_RaspberryPi_OSX.md
Running Clojure on Raspberry Pi with OS X

Clojure on Raspberry Pi with OS X

"Clojure running on Raspberry Pi" sounded so cool that I just had to give it a try.

Install JDK

  • Download ARM JDK from Oracle and instlal on Raspberry Pi
  • Change visudo to contain the following
@zilongshanren
zilongshanren / .eslintrc
Created May 12, 2016 03:34 — forked from cletusw/.eslintrc
ESLint Reset - A starter .eslintrc file that resets all rules to off and includes a description of what each rule does. From here, enable the rules that you care about by changing the 0 to a 1 or 2. 1 means warning (will not affect exit code) and 2 means error (will affect exit code).
{
// http://eslint.org/docs/rules/
"ecmaFeatures": {
"binaryLiterals": false, // enable binary literals
"blockBindings": false, // enable let and const (aka block bindings)
"defaultParams": false, // enable default function parameters
"forOf": false, // enable for-of loops
"generators": false, // enable generators
"objectLiteralComputedProperties": false, // enable computed object literal property names