Skip to content
View get-absolute-path.sh
#!/bin/bash
# REFERENCE: http://stackoverflow.com/a/1638397/1260526
# Absolute path to this script, e.g. /home/user/bin/foo.sh
SCRIPT=$(readlink -f "$0")
# Absolute path this script is in, thus /home/user/bin
SCRIPTPATH=$(dirname "$SCRIPT")
echo $SCRIPTPATH
View ubuntu-14-04-environment-setup.sh
wget https://github.com/leodutra/shell-scripts/archive/master.zip
unzip master.zip
rm -f master.zip
cd shell-scripts-master/environment/ubuntu-14-04/
bash environment-setup.sh
rm -Rf ./shell-scripts-master
View manual-hd-partiton-scheme-ubuntu-14
(MiB) Sector Type FS
------------------------------
8192 (swap) primary ext4
2048 /boot primary ext4
262144 / primary ext4
* /home logical ext4
View municipios-brasileiros-2016-01-05.csv
UF Municipio Desambiguação
GO Abadia de Goiás
MG Abadia dos Dourados
GO Abadiânia
MG Abaeté Abaeté (Minas Gerais)
PA Abaetetuba
CE Abaiara
BA Abaíra
BA Abaré
PR Abatiá
View municipios-brasileiros-2016-01-05.sql
CREATE TABLE IF NOT EXISTS `pais` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`nome` varchar(60) DEFAULT NULL,
`sigla` varchar(10) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
INSERT INTO `pais` (`id`, `nome`, `sigla`) VALUES (1, 'Brasil', 'BR');
View performance techs
Netty + Scala + Akka = Xitrum / Spray
Xitrum / Spray + Protobuf (Google)?
Ponylang > C > Scala (http://www.ponylang.org/papers/fast-cheap.pdf)
mTCP (https://www.usenix.org/conference/nsdi14/technical-sessions/presentation/jeong)
multipath TCP (https://www.youtube.com/watch?v=02nBaaIoFWU)
Aeron (http://www.infoq.com/presentations/aeron?utm_source=infoqWeeklyNewsletter&utm_medium=WeeklyNL_EditorialContent_development&utm_campaign=01192016news)
VMS (https://news.ycombinator.com/item?id=9584269)
Registered I/O (.NET)
View fast remove files windows
The worst way is to send to Recycle Bin: you still need to delete them. Next worst is shift+delete with Windows Explorer: it wastes loads of time checking the contents before starting deleting anything.
Next best is to use rmdir /s/q foldername from the command line. del /f/s/q foldername is good too, but it leaves behind the directory structure.
The best I've found is a two line batch file with a first pass to delete files and outputs to nul to avoid the overhead of writing to screen for every singe file. A second pass then cleans up the remaining directory structure:
del /f/s/q foldername > nul
rmdir /s/q foldername
This is nearly three times faster than a single rmdir, based on time tests with a Windows XP encrypted disk, deleting ~30GB/1,000,000 files/15,000 folders: rmdir takes ~2.5 hours, del+rmdir takes ~53 minutes. More info at Super User.
View municipios-brasileiros-2016-01-05
UF Municipio
GO Abadia de Goiás
MG Abadia dos Dourados
GO Abadiânia
MG Abaeté (Minas Gerais)|Abaeté
PA Abaetetuba
CE Abaiara
BA Abaíra
BA Abaré
View string-repeat.js
function repeat(str, times) {
var n = times | 0;
var res = '';
var buffer = str;
for (;;) {
if (n & 1) res += buffer;
if (n >>= 1) buffer += buffer;
else break;
}
return res;
View crossbrowser-optimum-simpleflake.js
var EPOCH = 946702800000; // epoch milliseconds, since 1 Jan 2000 00:00
var UNSIGNED_23BIT_MAX = 8388607; // (Math.pow(2, 23) - 1) >> 0
var FILLER = '0'.repeat(23);
function simpleflake() { // simpleflake = 41-bit timestamp + 23-bit random value
return parseInt(
(Date.now() - EPOCH).toString(2) +
(FILLER + ((Math.random() * UNSIGNED_23BIT_MAX) >>>/*force int*/0).toString(2)).substr(-23/*bit shifting*/)
, 2);
}
Something went wrong with that request. Please try again.