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 ( | |
"net/http" | |
) | |
func redirect(w http.ResponseWriter, req *http.Request) { | |
http.Redirect(w, req, | |
"https://" + req.Host + req.URL.String(), | |
http.StatusMovedPermanently) | |
} |
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
ls -v | cat -n | while read n f; do mv -n "$f" "$n.ext"; 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 | |
# Run `nvm use` when changing into directory if the .nvmrc exists | |
function cd() { | |
builtin cd "$@" | |
if [[ -e .nvmrc ]] | |
then | |
nvm use | |
fi |
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 | |
if [ -d ".git" ]; then | |
echo "git repo detected" | |
echo "checking out $1..." | |
git checkout $1 | |
echo "fetching origin $1..." | |
git fetch origin $1 | |
echo "merging origin $1 to local $1..." | |
git merge origin/$1 | |
echo "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
#!/usr/bin/env bash | |
# Install cardano-cli or use docker https://gist.github.com/ilyar/bf4c2346be1a74c50e488181986808fb | |
# | |
# Linux https://hydra.iohk.io/job/Cardano/cardano-node/cardano-node-linux/latest-finished | |
# Win64 https://hydra.iohk.io/job/Cardano/cardano-node/cardano-node-win64/latest-finished | |
# Macos https://hydra.iohk.io/job/Cardano/cardano-node/cardano-node-macos/latest-finished | |
# Extcact only cardano-cli into /usr/local/bin/cardano-cli | |
# Check | |
cardano-cli --version |
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
_..--""---. | |
/ ". | |
` l | |
|'._ ,._ l/"\ | |
| _J<__/.v._/ | |
\( ,~._,,,,-) | |
`-\' \`,,j| | |
\_,____J | |
.--.__)--(__.--. | |
/ `-----..--'. j |
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 safebuffer | |
import ( | |
"bytes" | |
"sync" | |
) | |
// Buffer is a goroutine safe bytes.Buffer | |
type Buffer struct { | |
buffer bytes.Buffer |
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
CONTAINER="name" | |
DB="Db name" | |
TABLE="Table Name" | |
FILE="file.csv" | |
sudo docker exec -u postgres ${CONTAINER} psql -d ${DB} -c "COPY ${TABLE} TO STDOUT WITH CSV HEADER " > ${FILE} | |
# Copy csv to table | |
# sudo psql -h localhost -U root -d my_db -p 5432 -c "\COPY source_table TO '/home/user/source_table.csv' DELIMITER ',' CSV HEADER;" |
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
int switchState = 0; | |
// pins | |
const int BUTTON = 2; | |
const int RED_LED = 3; | |
const int YELLOW_LED = 4; | |
const int GREEN_LED = 5; | |
void setup() { |
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 ( | |
"crypto/aes" | |
"crypto/cipher" | |
"crypto/rand" | |
"encoding/hex" | |
"fmt" | |
"io" | |
) |
NewerOlder