- jq - https://stedolan.github.io/jq/
- awscli - https://github.com/aws/aws-cli#installation
- sublime text 3 - https://www.sublimetext.com/3
$ cat ~/my_aws_stuff/bin/validate.sh
#!/bin/bash
#!/bin/bash | |
# get the IPs for current instance in ASG | |
region='us-east-1' | |
asgs=$(aws --region ${region} autoscaling describe-auto-scaling-groups --query 'AutoScalingGroups[?contains(AutoScalingGroupName, `stag`)].[AutoScalingGroupName][]' --output text) | |
for asg in ${asgs[@]}; do | |
echo "${asg}" | |
instances=$(aws --region ${region} autoscaling describe-auto-scaling-groups --auto-scaling-group-names ${asg} --query 'AutoScalingGroups[].Instances[].[InstanceId][]' --output text) | |
for instance in ${instances[@]}; do |
use std::collections::HashMap; | |
fn main() { | |
println!("{}", sing(3, 0)); | |
for i in (0..11).rev() { | |
println!("{}", verse(i)); | |
} | |
} |
package main | |
import "fmt" | |
import "math/big" | |
// we can't use a reference type as a key (*big.Int) so we need to cast to string to keep track | |
var seen = make(map[string]*big.Int) | |
func fibo(n *big.Int) *big.Int { | |
zero := big.NewInt(0) |
import Html exposing (..) | |
import Html.Attributes exposing (..) | |
import Html.Events exposing (onInput, onClick) | |
import String exposing (..) | |
import Char exposing (..) | |
main = | |
Html.beginnerProgram { model = model | |
, view = view | |
, update = update |
$ cat ~/my_aws_stuff/bin/validate.sh
#!/bin/bash
fn main() { | |
for x in 1..11 { | |
println!("{} -> {}", x, fibo(x)); | |
} | |
} | |
fn fibo(n: i32) -> f64 { | |
let phi = (1_f64 + 5_f64.sqrt()) / 2_f64; | |
(phi.powf(n as f64) / 5_f64.sqrt()).round() | |
} |
# stdlib | |
import multiprocessing as mp | |
from time import sleep | |
from subprocess import call | |
from urllib.parse import quote | |
# 3rd party | |
import requests | |
from slackbot.bot import Bot, respond_to | |
import validators |
$ cat tmp.txt | |
one | |
two | |
three | |
four | |
five | |
six | |
other | |
$ awk '/^t/ {q=1}q' tmp.txt | |
two |
import Html exposing (..) | |
import Html.App as App | |
import Html.Events exposing (..) | |
import Html.Attributes exposing (..) | |
import Random | |
-- MAIN | |
main = | |
App.program |
(lambda _, __, ___, ____, _____, ______, _______, ________: | |
getattr( | |
__import__(True.__class__.__name__[_] + [].__class__.__name__[__]), | |
().__class__.__eq__.__class__.__name__[:__] + | |
().__iter__().__class__.__name__[_____:________] | |
)( | |
_, (lambda _, __, ___: _(_, __, ___))( | |
lambda _, __, ___: | |
chr(___ % __) + _(_, __, ___ // __) if ___ else | |
(lambda: _).func_code.co_lnotab, |