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
# mail -s "subject" to-address < ./bodyfile.txt | |
mail -s "test email" some-user@some-domain < ./testemail.txt |
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
/** | |
* this file can be used when the pod doesn't have curl or wget and also non root user. | |
* assumed the pod is linux with nodejs installed | |
* | |
* copy the content to memory of your pc/mac, and in the pod, do : | |
* echo "{the-content-of-the-file}" > /tmp/example.js | |
* node /tmp/example.js | |
*/ | |
const https = require('https'); |
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 | |
# tested in .zshrc | |
# | |
# kubectl scale deploy name-of-deployment --replicas=0 | |
# kubectl scale deploy name-of-deployment --replicas=1 | |
alias kscale="kubectl scale deploy " | |
function krestart(){ | |
for i in {0..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
#!/bin/bash | |
# -F',' will split by comma | |
# BEGIN{RS="\r\n"} will remove \r\n (crlf) from the end of the string | |
# {print $3} will take the 3rd column and pass it to the next command | |
# -G option will read the data-urlencode | |
cat some.csv | awk -F',' 'BEGIN{RS="\r\n"}{print $3}' | while read x; do curl -v -G --data-urlencode "email=$x" \ | |
-X POST "https://path/to/the/host" \ | |
-H "accept: */*" \ | |
-H "Authorization: Bearer some-jwt-string-for-authorization"; done |
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 | |
# git | |
alias gp='git pull ' | |
alias gpo='git push origin ' | |
alias gs='git status ' | |
alias gsl='git stash list ' | |
alias gss='git stash save ' | |
alias gcm='git commit -m ' | |
alias ga='git add ' |
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 | |
cat my-target-files-in-s3.txt | awk '{print $4}' | while read x; do aws s3 rm "s3://my-bucket-name/$x"; done > my-delete-result.txt |
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 | |
# produce list of all files in buckets | |
echo "collecting..." | |
aws s3 ls --recursive my-bucket > my-files-in-bucket.txt |
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
# from https://code-maven.com/create-images-with-python-pil-pillow | |
from PIL import Image, ImageDraw, ImageFont | |
# mode L for grayscale | |
img = Image.new('RGB', (100, 30), color = (73, 109, 137)) | |
# font path | |
fnt = ImageFont.truetype('/Library/Fonts/Arial.ttf', 15) | |
d = ImageDraw.Draw(img) | |
d.text((10,10), "Hello world", font=fnt, fill=(255, 255, 0)) |
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
# get system fonts | |
import matplotlib.font_manager | |
matplotlib.font_manager.findSystemFonts(fontpaths=None, fontext='ttf') |
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
# post_loc.txt contains the json you want to post | |
# -p means to POST it | |
# -H adds an Auth header (could be Basic or Token) | |
# -T sets the Content-Type | |
# -c is concurrent clients | |
# -n is the number of requests to run in the test | |
ab -p post_loc.txt -T application/json -H 'Authorization: Token abcd1234' -c 10 -n 2000 http://example.com/api/v1/locations/ |
NewerOlder