old_array = [1, 4, 5]
new_array = [1, 2, 3, 4]
_.difference(new_array, old_array)
This file contains hidden or 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
const http = require('http') | |
const rpc = require('./rpc') | |
/** | |
* Pets service. | |
*/ | |
class Pets { | |
constructor(db = []) { |
This file contains hidden or 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
-- FUNCTION: public.base36_decode(character varying) | |
-- DROP FUNCTION public.base36_decode(character varying); | |
CREATE OR REPLACE FUNCTION public.base36_decode( | |
base36 character varying) | |
RETURNS bigint | |
LANGUAGE 'plpgsql' | |
COST 100 |
This file contains hidden or 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
<!--- | |
Parts of this are based on Tim Dawe's | |
http://amazonsig.riaforge.org | |
and | |
Joe Danziger's Amazon S3 REST Wrapper | |
http://amazons3.riaforge.org/ | |
Written by Patrick Liess |
This file contains hidden or 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
#host running out of memory! | |
ALERT HighMem | |
IF 100 -(node_memory_MemFree + node_memory_Buffers + node_memory_Cached) / node_memory_MemTotal* 100 > 80 | |
FOR 1m | |
WITH { | |
severity="page" | |
} | |
SUMMARY "Instance {{$labels.host}} has high memory consumption" | |
DESCRIPTION "{{$labels.host}} of job {{$labels.job}} has less than 40% of memory available for more than 1 minutes." |
This file contains hidden or 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
# SYSTEM: open a file as admin with a special app | |
sudo open -a /Applications/Utilities/Console.app/ /usr/local/mysql/data/Mathiass-iMac.log | |
# SYSTEM: Create a symbolic link | |
ln -s /Path/to/original/folder New-folder-name | |
# SYSTEM: show long running clock | |
clear; while true; do echo -e \\b\\b\\b\\b\\b\\b\\b\\b`date +%T`\\c ; sleep 1; done | |
# SYSTEM: Set ENV var |
This file contains hidden or 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
# Build dependencies for OpenResty. | |
sudo apt-get install build-essential libpcre3-dev libssl-dev libgeoip-dev | |
# Install standard Nginx first so that you get the relevant service scripts installed too | |
sudo apt-get install nginx | |
# If you want to access Postgres via Nginx | |
sudo apt-get install libpq-dev |
This file contains hidden or 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
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9 | |
sudo sh -c "echo deb https://get.docker.com/ubuntu docker main > /etc/apt/sources.list.d/docker.list" | |
sudo apt-get update | |
sudo apt-get install -y lxc-docker | |
docker -v |
This file contains hidden or 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
for line in `docker ps | awk '{print $1}' | grep -v CONTAINER`; do docker ps | grep $line | awk '{printf $NF" "}' && echo $(( `cat /sys/fs/cgroup/memory/docker/$line*/memory.usage_in_bytes` / 1024 / 1024 ))MB ; done |
NewerOlder