View Android TimeExpiringLruCache.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.HashMap; | |
import java.util.LinkedHashMap; | |
import java.util.Map; | |
import android.os.SystemClock; | |
public class TimeExpiringLruCache<K, V> { | |
private final LinkedHashMap<K, V> map; | |
private final HashMap<K, Long> validityTime; |
View Rx.Observable.cacheWithExpiration-demo.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var slowJob = Rx.Observable.defer(function () { | |
return Rx.Observable.return(Math.random() * 1000).delay(2000); | |
}); | |
var cached = slowJob.cacheWithExpiration(5000); | |
var last = Date.now(); | |
function repeat() { | |
last = Date.now(); | |
cached.subscribe(function (data) { |
View docker_1.13_manual_install_centos.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
yum install wget | |
wget https://yum.dockerproject.org/repo/main/centos/7/Packages/docker-engine-1.13.1-1.el7.centos.x86_64.rpm | |
wget https://yum.dockerproject.org/repo/main/centos/7/Packages/docker-engine-selinux-1.13.1-1.el7.centos.noarch.rpm | |
#nice site with pckgs: https://pkgs.org/ | |
#package for docker-engine-selinux | |
yum install -y policycoreutils-python | |
rpm -i docker-engine-selinux-1.13.1-1.el7.centos.noarch.rpm |
View openssl_split_one_pem_to_multiple.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wget -O - http://curl.haxx.se/ca/cacert.pem | awk 'split_after==1{n++;split_after=0} /-----END CERTIFICATE-----/ {split_after=1} {print > "cert" n ".pem"}' |
View sysctl-conf.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#check if this script is running in su mode | |
func_check_for_root() { | |
if [ ! $( id -u ) -eq 0 ]; then | |
echo "ERROR: $0 Must be run as root, Script terminating" ;exit 7 | |
fi | |
} | |
func_check_for_root | |
View fedora-install-nodejs.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
func_check_for_root() { | |
if [ ! $( id -u ) -eq 0 ]; then | |
echo "ERROR: $0 Must be run as root, Script terminating" ;exit 7 | |
fi | |
} | |
func_check_for_root | |
#SETUP PARAMS |
View BootstrapFormHelper.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org) | |
* | |
* Licensed under The MIT License | |
* | |
* Copyright (c) La Pâtisserie, Inc. (http://patisserie.keensoftware.com/) | |
* @license MIT License (http://www.opensource.org/licenses/mit-license.php) | |
*/ | |
App::uses('FormHelper', 'View/Helper'); |
View compile-elixir-v1.6.3.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# requirement: erlang, git | |
ELIXIR_VERSION="1.6.3" | |
sudo apt-get update && sudo apt-get install -y git && \ | |
rm -rf /tmp/code/elixir/${ELIXIR_VERSION} && mkdir -p /tmp/code/elixir/${ELIXIR_VERSION} && cd /tmp/code/elixir/${ELIXIR_VERSION} && \ | |
git clone -b "v${ELIXIR_VERSION}" --single-branch --depth 1 https://github.com/elixir-lang/elixir.git . && \ | |
make clean test && \ | |
sudo make install && \ | |
cd && rm -rf /tmp/code/elixir && \ | |
echo "Check your elixir version by typing 'iex --version'" |
View react-native-clear-all.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rm /tmp/haste-* /tmp/flow /tmp/metro-* /tmp/socketcluster/ -rf && watchman watch-del-all | |
yarn start -- --reset-cache |
View generate_files.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#size magnitude | |
sizes=( "" "K" "M" ) | |
for magnitude in "${sizes[@]}"; do | |
for size in `seq 1 5 51`; do | |
echo "Generating ${size}${magnitude}" | |
head -c ${size}${magnitude} </dev/urandom >file-${size}${magnitude}.bin |
NewerOlder