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
'use strict'; | |
var echoPort = '/dev/pts/3'; | |
var track = ''; | |
var _require = require('child_process'), | |
spawn = _require.spawn, | |
exec = _require.exec; | |
var child = spawn('./dejarik'); |
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
# Standard | |
*/5 * * * * cd /path/to/repo && git pull origin master | |
# Overwrite all changes with master | |
*/5 * * * * cd /path/to/repo && git fetch --all && git reset --hard origin/master | |
# Pull changes, but persist local changes (i.e. config that is not checked into repo) | |
*/5 * * * * cd /path/to/repo && git stash && git pull origin master && git stash pop |
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
# Standard | |
*/5 * * * * cd /path/to/repo && git pull origin master | |
# Overwrite all changes with master | |
*/5 * * * * cd /path/to/repo && git fetch --all && git reset --hard origin/master | |
# Pull changes, but persist local changes (i.e. config that is not checked into repo) | |
*/5 * * * * cd /path/to/repo && git stash && git pull origin master && git stash pop |
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
/** | |
* | |
* Conway's Game of Life | |
* 1. If a live cell has less than 2 live neighbors, it dies. * | |
* 2. If a live cell has more than 3 live neighbors, it dies. * | |
* 3. If a live cell has exactly 2-3 live neighbors, it lives. * | |
* 4. If a dead cell has exactly 3 live neighbors, it comes to life. * | |
* 0 == DEAD | |
* 1 == ALIVE |
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
# Provided Input: | |
# logs = """ | |
# timestamp="Wed Jun 19 09:35:36 PDT 2019" message="test 10" id=10 field_1="test 10" field_6="test 1" | |
# timestamp="Wed Jun 19 09:35:37 PDT 2019" message="test 4" id=4 field_2="test 4" | |
# timestamp="Wed Jun 19 09:35:38 PDT 2019" message="test 2" id=3 field_3="test 2" field_9="test 23" | |
# timestamp="Wed Jun 19 09:35:39 PDT 2019" message="test 3" id=2 field_4="test 3" | |
# timestamp="Wed Jun 19 09:35:40 PDT 2019" message="test 4" id=1 field_5="test 4" | |
# timestamp="Wed Jun 19 09:35:37 PDT 2019" message="test 5" id=5 field_3="test 10" | |
# timestamp="Wed Jun 19 09:35:40 PDT 2019" message="test 6" id=6 field_1="test 5" |
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 | |
# Methods for working with json in bash | |
# ************************************************************* # | |
# Setup | |
BUCKET_NAME=testbucket | |
OBJECT_NAME=testworkflow-2.0.1.jar | |
TARGET_LOCATION=/opt/test/testworkflow-2.0.1.jar |
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
# ENV-DEPLOYMENT_ID-APP_NAME-INSTANCE_NUM.DOMAIN | |
# Prod-20160502-app-02.company.local | |
# Qa-20181001-app-02.company.local | |
# Qa-20181001-app-04.company.local | |
# Qa-20181002-myapp-01.company.local | |
# | |
# # ENV<TAB>APP_NAME<TAB>DEPLOYMENT_ID<TAB>COUNT_OF_INSTANCES | |
# Prod app 20160502 1 | |
# Qa app 20181001 2 | |
# Qa myapp 20181002 1 |
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
# Given an array of integers, return indices of the two numbers | |
# such that they add up to a specific target. | |
# You may assume that each input would have exactly one solution, | |
# and you may not use the same element twice. | |
# Example: [1,2,3,4], 7 -> 2,3 | |
# chmod +x get-sum-target-index-thing.sh && ./get-sum-target-index-thing.sh 7 1 2 3 4 | |
if [ -z "$1" ]; then |
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
# sqs (unit test) | |
# input: {"id": "data1"} | |
# push, pop, mark_complete, mark_pending | |
QUEUE="./queue.txt" | |
# echo "{\"id\":\"data1\"}" > queue.txt | |
# cat queue.txt | |
mypush() { | |
if [ -z "$1" ]; then |
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 | |
#class RateLimiter { | |
# public: | |
# // rate is an integer num requests per second | |
# RateLimiter(int rate) { | |
# } | |
# bool IsAllowed() { | |
# //implement this |
OlderNewer