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
| /* | |
| This demonstrates a task scheduling loop where tasks can send back other tasks to the queue. | |
| Program input: a nested list of items that can either be integers, or nested slices: | |
| - when it's an integer, wait for 25 - value seconds | |
| - when it's a slice, wait for len(slice) seconds, then put back each item in the queue to be processed next | |
| waiting time simulates some processing, on which a concurrency limit is applied ( both waiting times share the same | |
| limit ). pushing back to the queue should not be blocking. |
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 jwt_test | |
| func parsePrivatePEM(pemString string) *rsa.PrivateKey { | |
| block, _ := pem.Decode([]byte(pemString)) | |
| key, _ := x509.ParsePKCS1PrivateKey(block.Bytes) | |
| return key | |
| } | |
| func parsePublicPEM(pemString string) *rsa.PublicKey { | |
| block, _ := pem.Decode([]byte(pemString)) |
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 generateCurlTest(testName string, r *http.Request, w *httptest.ResponseRecorder) { | |
| fmt.Println(fmt.Sprintf("### %s", testName)) | |
| var b []byte | |
| if r.Body != nil { | |
| b, _ = ioutil.ReadAll(r.Body) | |
| } | |
| r.Body = ioutil.NopCloser(bytes.NewBuffer(b)) | |
| command, _ := http2curl.GetCurlCommand(r) | |
| fmt.Printf("```\n%s\n```\n", command) | |
| r.Body = ioutil.NopCloser(bytes.NewBuffer(b)) |
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 | |
| echo "Waiting for dynamodb to be up" | |
| until aws dynamodb --endpoint-url http://mock-aws:4566 list-tables 2>/dev/null; do echo "Waiting for localstack to be ready";sleep 1; 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
| function review_go_branch(){ | |
| compareAgainst="$1" | |
| if [ -z "$compareAgainst" ] | |
| then | |
| compareAgainst="origin/master" | |
| fi | |
| files=($(git diff --name-status --diff-filter=ACM $compareAgainst | awk '{print $2}')) | |
| if [ -z "$files" ] | |
| then | |
| return 0 |
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 | |
| # An example hook script to verify what is about to be pushed. Called by "git | |
| # push" after it has checked the remote status, but before anything has been | |
| # pushed. If this script exits with a non-zero status nothing will be pushed. | |
| # | |
| # This hook is called with the following parameters: | |
| # | |
| # $1 -- Name of the remote to which the push is being done | |
| # $2 -- URL to which the push is being 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
| export EDITOR=vim | |
| # This will allow me to send files to my already open vim | |
| # from the command line. | |
| # Automatically focuses on the first pane which should be | |
| # where my vim instanse lives | |
| tab(){ | |
| vim --servername workspace --remote-tab "$@" | |
| tmux select-pane -t 0 | |
| } |
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 | |
| # Dependencies: xargs, jq | |
| # | |
| # Example usages: | |
| # fsToJson file file2 file2 | |
| # fsToJson $(ls file*) | |
| # will generate something like | |
| # { | |
| # "file": "file contents", |
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
| Bee Movie Script - Dialogue Transcript | |
| According to all known laws | |
| of aviation, | |
| there is no way a bee | |
| should be able to fly. |
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
| [Unit] | |
| Description=Phonesim service | |
| Requires=ofono.service | |
| StartLimitedIntervalSec=0 | |
| [Service] | |
| Type=simple | |
| Restart=always | |
| RestartSec=1 | |
| ExecStart=/usr/bin/phonesim -p 12345 /usr/share/phonesim/default.xml |