Skip to content

Instantly share code, notes, and snippets.

@yakaas
yakaas / set-go-at.sh
Created December 18, 2022 03:11 — forked from comradequinn/goto.sh
Script to Switch Between Active Versions of Go
#! /usr/bin/bash
go_dir="/usr/local/go"
version=${1}
version_dir="#unset#"
dl_url="#unset#"
gos_dir="/usr/local/gos"
tar_file=".temp-go.tar.gz"
temp_dir=".temp"
package main
 
import (
"fmt"
"reflect"
)
 
type testStruct struct {
    A int
    B string
type T struct {
A int
B string
}
t := T{23, "skidoo"}
s := reflect.ValueOf(&t).Elem()
typeOfT := s.Type()
for i := 0; i < s.NumField(); i++ {
https://jqplay.org/s/DljtxNX_72
.ResourceRecordSets[] | select (.Type=="A")
.[] | select (.Name | contains( "mobile"))
aws route53 list-hosted-zones | jq '.HostedZones | .[] | select (.Name | contains( "cloud.bumble.cau"))'
aws ec2 describe-instances | jq '.Reservations[].Instances[] | select (.NetworkInterfaces[].PrivateIpAddress == "172.22.13.60")'
resource "aws_ebs_volume" "elasticsearch_master" {
count = 3
availability_zone = "${lookup(var.azs, count.index)}"
size = 8
type = "gp2"
tags {
Name = "elasticsearch_master_az${count.index}.${var.env_name}"
}
}
INSTANCE_ID=`curl http://169.254.169.254/latest/meta-data/instance-id`
# wait for ebs volume to be attached
while :
do
# self-attach ebs volume
aws --region us-east-1 ec2 attach-volume --volume-id ${volume_id} --instance-id $INSTANCE_ID --device ${device_name}
if lsblk | grep ${lsblk_name}; then
echo "attached"
#!/bin/bash
while [ ! -e /dev/xvdf ]; do sleep 1; done
fstab_string='/dev/xvdf /data ext4 defaults,nofail,nobootwait 0 2'
if grep -q -F -v "$fstab_string" /etc/fstab; then
echo "$fstab_string" | sudo tee -a /etc/fstab
fi
sudo mkdir -p /data && sudo mount -t ext4 /dev/xvdf /data
@yakaas
yakaas / Singleton
Last active January 18, 2016 21:59
Singleton - fully lazy instantiation
// http://csharpindepth.com/Articles/General/Singleton.aspx#nested-cctor
public sealed class Singleton
{
private Singleton()
{
}
public static Singleton Instance { get { return Nested.instance; } }
@yakaas
yakaas / gist:806d50918787392b76bd
Created December 21, 2015 00:27
linux ps memroy
https://raw.githubusercontent.com/pixelb/ps_mem/master/ps_mem.py
@yakaas
yakaas / Install-Docker-on-Linux-Mint.sh
Last active December 9, 2015 00:41 — forked from sirkkalap/Install-Docker-on-Linux-Mint.sh
Install Docker on Linux Mint
##########################################
# To run:
# curl -sSL https://gist.githubusercontent.com/yakaas/c8ed85e6e5173e5b9852/raw/5945de1f91be09302f70280d6d00d3f5f8505a42/Install-Docker-on-Linux-Mint.sh | bash -x
##########################################
# Check that HTTPS transport is available to APT
if [ ! -e /usr/lib/apt/methods/https ]; then
sudo apt-get update
sudo apt-get install -y apt-transport-https
fi