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
| // From dart algorithm package | |
| /** Version of [binarySearch] optimized for comparable keys */ | |
| int _comparableBinarySearch(List<Comparable> list, Comparable key) { | |
| int min = 0; | |
| int max = list.length; | |
| while (min < max) { | |
| int mid = min + ((max - min) >> 1); | |
| var element = list[mid]; | |
| int comp = element.compareTo(key); | |
| if (comp == 0) return mid; |
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
| http://stackoverflow.com/questions/18845814/bash-extracting-file-basename-from-long-path | |
| files=( /very/long/path/to/various/files/*.file ) | |
| for file in "${files[@]}" | |
| do | |
| filename="${file##*/}" | |
| filenameWithoutExtension="${filename%.*}" | |
| echo "$filenameWithoutExtension" | |
| 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
| #!/bin/bash | |
| # Install: | |
| # curl -O https://gist.github.com/nechkin/0ac33fad55f777c9994d#file-autossh-initd-elastic-tunnel-setup-sh | |
| # chmod u+x autossh-initd-elastic-tunnel-setup.sh | |
| # ./autossh-initd-elastic-tunnel-setup.sh | |
| SSH_USER="EBdev" | |
| SSH_SERVER="172.22.40.10" | |
| SSH_PORT="22" |
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
| user="root" | |
| group="root" | |
| chroot="/" | |
| chdir="/" | |
| nice="" |
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/sh | |
| # Init script for kibana | |
| # From Kibana package | |
| # Generated by pleaserun. | |
| # Implemented based on LSB Core 3.1: | |
| # * Sections: 20.2, 20.3 | |
| # | |
| ### BEGIN INIT INFO | |
| # Provides: kibana | |
| # Required-Start: $remote_fs $syslog |
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
| /** | |
| * WkHtmlToPdf table splitting hack. | |
| * | |
| * Script to automatically split multiple-pages-spanning HTML tables for PDF | |
| * generation using webkit. | |
| * | |
| * To use, you must adjust pdfPage object's contents to reflect your PDF's | |
| * page format. | |
| * The tables you want to be automatically splitted when the page ends must | |
| * have a class name of "splitForPrint" (can be changed). |
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/sh | |
| # check for where the latest version of IDEA is installed | |
| IDEA=`ls -1d /Applications/IntelliJ\ * | tail -n1` | |
| wd=`pwd` | |
| # were we given a directory? | |
| if [ -d "$1" ]; then | |
| # echo "checking for things in the working dir given" | |
| wd=`ls -1d "$1" | head -n1` |
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
| import java.util.ArrayList; | |
| import java.util.Arrays; | |
| import java.util.List; | |
| /** | |
| * Type is erase in bytecode, but which method to call is inferred at compile type, when generics are available | |
| */ | |
| class Scratch { | |
| // can be called with Arrays.asList("a", "b"), type is inferred to String |
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
| #!/usr/local/bin/perl | |
| use strict; | |
| use YAML::Tiny; | |
| my $maxAttempts = 60; | |
| my $timeoutSeconds = 60; | |
| # шаблон для команды получения списка Ready статусов для всех подов с заданым лейблом | |
| my $separator = '\t'; | |
| my $jsonPath = '{range .items[*]}{@.metadata.name}{"'.$separator.'"}{@.status.conditions[?(@.type=="Ready")].status}{"\n"}{end}'; |
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 | |
| # script runs rabbit-init.jar waits 30 seconds for it to finish | |
| # (wait time can be set with WAIT_TOTAL env property) | |
| properties_location=$1 | |
| wait_pid() { | |
| local pid="$1"; shift | |
| local wait_total="${1:-10}"; shift # 10 seconds as default timeout |
OlderNewer