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
(Originally found at: https://pastebin.com/Lkjad3y6) | |
The Bus | |
----------------- | |
The streets of Byte City form a regular, chessboardlike network - they are either north-south or west-east directed. We shall call them NS- and WE-streets. Furthermore, each street crosses the whole city. Every NS-street intersects every WE- one and vice versa. The NS-streets are numbered from 1 to n, starting from the westernmost. The WE-streets are numbered from 1 to m, beginning with the southernmost. Each intersection of the i-th NS-street with the j-th WE-street is denoted by a pair of numbers (i, j) (for 1 <= i <= n, 1 <= j <= m). | |
There is a bus line in Byte City, with intersections serving as bus stops. The bus begins its itinerary by the (1, 1) intersection, and finishes by the (n, m) intersection. Moreover, the bus may only travel in the eastern and/or northern direction. | |
There are passengers awaiting the bus by some of the intersections. The bus driver wants to choose his route in a way that allows him to take as many |
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
func main() { | |
ctx := context.Background() | |
// trap Ctrl+C and call cancel on the context | |
ctx, cancel := context.WithCancel(ctx) | |
c := make(chan os.Signal, 1) | |
signal.Notify(c, os.Interrupt) | |
defer func() { | |
signal.Stop(c) |
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
package main | |
// Run at: https://play.golang.org/p/waIvysrhXJ | |
import ( | |
"container/ring" | |
"fmt" | |
) | |
type CircularList struct { |
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
package main | |
import ( | |
"fmt" | |
) | |
func main() { | |
incr := incr() | |
for i := 0; i < 10; i++ { | |
fmt.Printf("Count: %d\n", incr()) |
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
#!/bin/bash | |
TOPICS=$(kafka-topics --zookeeper [ZK_IP]:2181/kafka --list ) | |
for T in $TOPICS | |
do | |
if [ "$T" != "__consumer_offsets" ]; then | |
kafka-topics --zookeeper [ZK_IP]:2181/kafka --delete --topic $T | |
fi | |
done |
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
# First install exiftool with Brew if you don't already have it | |
brew install exiftool | |
# Next, remove all metadata form the image | |
exiftool -all= [IMAGE_FILENAME] | |
# Now resize the image | |
sips -Z [MAX_HEIGHT_AND_WIDTH] [IMAGE_NAME] |
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
# Once | |
chef exec gem install knife-solo_data_bag | |
# Then run this to create the databag | |
chef exec knife solo data bag create [BAG_NAME] [ITEM_NAME] --secret-file '[PATH_TO_SECRET]' --data-bag-path test/integration/default/data_bags/ |
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
#!/bin/bash | |
if [ "$1" == "" ] || [ "$2" == "" ]; then | |
echo "Usage: ./reindex.sh [REMOTE_HOST:REMOTE_PORT] [INDEX_PATTERN] [LOCAL_HOST:LOCAL_PORT]" | |
exit 1 | |
fi | |
REMOTE_HOST=$1 | |
PATTERN=$2 | |
if [ "$3" == "" ]; then |
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
### Keybase proof | |
I hereby claim: | |
* I am hartfordfive on github. | |
* I am hartfordfive (https://keybase.io/hartfordfive) on keybase. | |
* I have a public key ASCs9zG687c1KzH-HLDL9Z6lZ6_fHXxOhsswK9_XYb19TQo | |
To claim this, I am signing this object: |
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
#!/bin/bash | |
yum install -y wget | |
wget https://archives.streamsets.com/datacollector/2.3.0.0/csd/STREAMSETS-2.3.0.0.jar | |
mv STREAMSETS-2.3.0.0.jar /opt/cloudera/csd/ | |
chown cloudera-scm:cloudera-scm STREAMSETS-2.3.0.0.jar | |
chmod 775 STREAMSETS-2.3.0.0.jar | |
/etc/init.d/cloudera-scm-server restart |