# in one terminal
docker run -it --rm -p 27017:27017 mongo:6
# in one terminal
docker run -it --rm -p 27017:27017 mongo:7
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
# Courtesy of: https://stackoverflow.com/a/11974399 | |
{%- for item in items %} | |
[ | |
"{{item}}"{{ "," if not loop.last }} | |
] | |
{%- endfor %} |
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
# IE users need: https://get.adobe.com/reader/ | |
from PyPDF2 import PdfFileWriter, PdfFileReader | |
output = PdfFileWriter() | |
ipdf = PdfFileReader(open('old.pdf', 'rb')) | |
for i in xrange(ipdf.getNumPages()): | |
page = ipdf.getPage(i) | |
output.addPage(page) |
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
#!/usr/bin/env bash | |
set -e | |
# check if disk is attached | |
sda1_attached=false | |
sdb1_attached=false | |
if lsblk | grep -q "sda1"; then | |
sda1_attached=true |
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 chatgpt | |
// list all event listeners on process | |
const eventNames = process.eventNames(); | |
eventNames.forEach((eventName) => { | |
const listeners = process.listeners(eventName); | |
console.log(`Event: ${eventName}`); | |
console.log(`Listeners:`); | |
listeners.forEach((listener, index) => { | |
console.log(` Listener ${index + 1}: ${listener.toString()}`); | |
// Note: listener.toString() might not always give meaningful information, |
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
frontend rdp | |
mode tcp | |
bind 192.168.1.11:3389 | |
tcp-request inspect-delay 2s | |
tcp-request content accept if RDP_COOKIE | |
acl userID_a19281 rdp_cookie(mstshash) -i user123 | |
use_backend backend_a19281 if userID_a19281 | |
acl userID_8721bc rdp_cookie(mstshash) -i user456 |
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
asdf plugin add gcloud https://github.com/jthegedus/asdf-gcloud | |
echo "gcloud 410.0.0" >> ~/.tool-versions | |
asdf install | |
gcloud auth login | |
gcloud projects list | |
gcloud config set project $GCP_PROJECT_ID | |
# pull logs from cloudbuild | |
# add grep to this command for specific hash.. then cut -d' ' -f1 for the ID.. maybe can filter directly |
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
package main | |
import ( | |
"fmt" | |
"os" | |
"text/template" | |
) | |
type Person struct { | |
Name string |
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
docker run -it --rm --init "${DOCKER_IMAGE}" |
NewerOlder