Skip to content

Instantly share code, notes, and snippets.

@anhhh11
anhhh11 / aria2.daemon
Created Mar 29, 2019 — forked from h0tw1r3/aria2.daemon
Aria2c systemd service
View aria2.daemon
continue
dir=/var/www/downloads
file-allocation=trunc
max-connection-per-server=4
max-concurrent-downloads=2
max-overall-download-limit=0
min-split-size=25M
View backup folder
tar pczf ui.tar.gz ./ --exclude="**/node_modules" --exclude="**/__build__" --exluce="**/logs"
@anhhh11
anhhh11 / config
Created Apr 28, 2018 — forked from rbialek/config
ssh/.config
View config
Host github.com
User git
Hostname github.com
PreferredAuthentications publickey
IdentityFile /home/user/.ssh/id_rsa
View tmux-cheatsheet.markdown

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@anhhh11
anhhh11 / test-simple-http-data.js
Created Aug 9, 2016 — forked from murvinlai/test-simple-http-data.js
Socket Hang up problem - A sample to generate the problem.
View test-simple-http-data.js
/*
* This is a simple HTTP data generator for testing.
*
*/
var http = require('http');
var counter = 0;
http.createServer(function (req, res) {
var start = new Date();
View Atom useful package
# From https://scotch.io/bar-talk/best-of-atom-features-plugins-acting-like-sublime-text
apm install simple-drag-drop-text git-plus tortoise-svn vim-mode merge-conflicts color-picker emmet docblockr pigments linter autocomplete-modules auto-update-packages file-icons minimap project-manager
apm install browser-plus terminal-plus git-time-machine expand-selection-to-quotes grammar-token-limit swackets recent-files-fuzzy-finder tree-view-git-status
apm install react tortoise-svn atom-beautify autoclose-html
apm list --installed --bare > package-list.txt
apm install --packages-file package-list.txt
@anhhh11
anhhh11 / README.md
Created Feb 15, 2016 — forked from zaim/README.md
Thunkify Rethinkdb
View README.md

rethunkdb

Thunkify rethinkdb

To be used with co and/or koa.

So that we can do something like:

var r = require('rethunkdb')  // not a typo, might use other name if too close :)
View OOP in JS.js
var Pen = function(position){
this.position = position;
}
Pen.prototype.move = function(toPostition){
this.position = position
}
Pen.prototype.select = function(select){
this.select = select;
}
Pen.prototype.toJSON = function(){
View index.html
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-git2.js"></script>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<div id="box">Hello</div>
<script id="jsbin-javascript">
View Tesseract - OCR
gs -sDEVICE=tiffgray -dNOPAUSE -r300 -sOutputFile="o-%04d.tiff" ./ttnt.pdf -c quit
for i in *.tif ; do tesseract $i $i -l vie -psm 1 ; done
mkdir done
for i in *.tiff;do if [ -f $i.txt ];then mv $i.txt done/;mv $i done/;fi;done
gs -sDEVICE=jpeg -dJPEGQ=100 -dNOPAUSE -r300 -sOutputFile="o-%04d.jpeg" ./ttnt.pdf -q -c quit
for i in done/*.txt; do j="`basename -s .tiff.txt $i`.jpeg";if [ -f $j ];then rm -f $j;fi; done
for i in *.jpeg ; do tesseract $i $i -l vie; done