An introduction to curl
using GitHub's API.
Makes a basic GET request to the specifed URI
curl https://api.github.com/users/caspyin
Includes HTTP-Header information in the output
#!/bin/bash | |
role_name=`curl -s http://169.254.169.254/latest/meta-data/iam/security-credentials/` | |
creds=`curl -s http://169.254.169.254/latest/meta-data/iam/security-credentials/$role_name` | |
current_region=`curl -s http://169.254.169.254/latest/dynamic/instance-identity/document | jq -c -r .region` | |
export AWS_ACCESS_KEY_ID=`printf "%s" "$creds" | jq -r .AccessKeyId` | |
export AWS_SECRET_ACCESS_KEY=`printf "%s" "$creds" | jq -r .SecretAccessKey` | |
export AWS_SESSION_TOKEN=`printf "%s" "$creds" | jq -r .Token` | |
export AWS_DEFAULT_REGION=$current_region |
Plug in cooker. | |
Cooker powers on momentarily and is unusable. | |
Fill water to MAX port. | |
Touch POWER button for 5 seconds. | |
Cooker powers on and is usable. | |
Touch POWER and SET. | |
SET TEMP field flashes. | |
Units toggle between °C & °F. | |
Turn wheel. | |
Field value changes. |
#!/bin/sh | |
set -e | |
HOST=localhost | |
DB=test-entd-products | |
COL=asimproducts | |
S3PATH="s3://mongodb-backups-test1-entd/$DB/$COL/" | |
S3BACKUP=$S3PATH`date +"%Y%m%d_%H%M%S"`.dump.gz | |
S3LATEST=$S3PATH"latest".dump.gz | |
/usr/bin/aws s3 mb $S3PATH |
package main | |
import ( | |
"fmt" | |
"io" | |
"log" | |
"os" | |
"golang.org/x/crypto/ssh/terminal" | |
) |
#!/bin/bash | |
export AnException=100 | |
export AnotherException=101 | |
# start with a try | |
try | |
( # open a subshell !!! | |
echo "do something" | |
[ someErrorCondition ] && throw $AnException |
An introduction to curl
using GitHub's API.
Makes a basic GET request to the specifed URI
curl https://api.github.com/users/caspyin
Includes HTTP-Header information in the output
Action | tmux | screen |
---|---|---|
start a new session | tmux tmux new tmux new-session |
screen |
start a new session with a name | tmux new -s name | screen -S name |
re-attach a detached session | tmux attach tmux attach-session |
screen -r |
re-attach a detached session with a name | tmux attach -t name tmux a -t name |
screen -r name |
re-attach an attached session (detaching it from elsewhere) | tmux attach -dtmux attach-session -d | screen -dr |
#!/usr/bin/env bash | |
# | |
# Example of multiple key AES encryption for text files using the openssl v. 0.9.8+ command line utility | |
# Uses n public certs as key for MIME PKCS envelope, any individual private key can decrypt. | |
# | |
# If standard RSA ssh keys exist, these can be converted to public certs as well (and ssh keys can decrypt) | |
# | |
# To sign (and verify) the encrypted file, one of the private keys is required, see: | |
# http://www.openssl.org/docs/apps/smime.html#EXAMPLES for openssl smime examples | |
# or http://www.openssl.org/docs/apps/cms.html#EXAMPLES for cms utility (OpenSSL v. 1.0+) |
This is a bookmarklet that adds a fully functional Fork button to your own Gist.
If a Fork button is already present in the page, this bookmarklet will set focus to it instead of adding another one.
The change is temporary and the button will disappear as soon as you navigate away from that Gist (clicking the Fork button does this for you as well).
This article is now published on my website: A one-off git repo server.