Skip to content

Instantly share code, notes, and snippets.

@masci
masci / telnet and wait
Created September 30, 2014 20:35
using AppleScript to start a telnet console and wait for it to finish
#!/bin/sh
osascript <<EOF
tell application "Terminal"
activate
set _tab to do script "telnet 127.0.0.1 2001 ; exit"
delay 1
repeat while _tab exists
delay 1
end repeat
@miracle2k
miracle2k / jsonalchemy.py
Last active March 26, 2021 05:19 — forked from dbarnett/jsonalchemy.py
Support Raw json objects, OrderedDict, dates.
import json
import sqlalchemy
from sqlalchemy import UnicodeText
from sqlalchemy.ext.mutable import Mutable
from datetime import datetime
from collections import OrderedDict
__all__ = ('JSON', 'JsonRaw')
@hayderimran7
hayderimran7 / deploy.md
Last active September 23, 2021 02:56
Automatically deploy GoDaddy External Secrets Controller for SSM/Secrets Manager in K8s with IAM role for service account
#!/bin/bash -xe
## SET BASIC VARIABLES
EKS_CLUSTER="dev-cluster"
IAM_ROLE_NAME=eksctl-$EKS_CLUSTER-iamserviceaccount-role
EXTERNAL_SECRETS_POLICY="kube-external-secrets"
#### CREATE POLICY TO ACCESS SSM/Secrets Manager
cat << EOF > policy.json
{
@jgornick
jgornick / docker-cleanup.sh
Created May 20, 2016 19:07
Docker: Cleanup (Remove all exited containers and dangling images)
#!/bin/bash
docker rm $(docker ps -q -f status=exited)
docker rmi $(docker images -q -f dangling=true)
@xxxVxxx
xxxVxxx / gist:9648264fd6f41bbb1f65
Last active November 25, 2022 06:52
boto3 aws find all IAM accesskeys details for the account
import boto3
boto3.setup_default_session(profile_name='IAM')
resource = boto3.resource('iam')
client = boto3.client("iam")
KEY = 'LastUsedDate'
for user in resource.users.all():
@9point6
9point6 / ssh-retry.sh
Last active April 22, 2023 08:44
Keep retrying SSH connection until success (Useful for waiting for VMs to boot)
#!/usr/bin/env bash
# Check we've got command line arguments
if [ -z "$*" ] ; then
echo "Need to specify ssh options"
exit 1
fi
# Start trying and retrying
((count = 100))
@yannvery
yannvery / CHRUBY_add_ruby_version.md
Last active December 8, 2023 00:51
CHRUBY - How to install a new ruby version

Install a new ruby version with chruby

OSX

First of all you must update ruby-build to update definitions list.

brew update

And update ruby-build

@BretFisher
BretFisher / pcat-install.sh
Last active February 6, 2024 14:41
On macOS: Install pygmentize and alias pcat for shell code syntax highlighting
# first install pygmentize to the mac OS X or macOS system with the built-in python
sudo easy_install Pygments
# then add alias to your ~/.bash_profile or ~/.bashrc or ~/.zshrc etc.
alias pcat='pygmentize -f terminal256 -O style=native -g'
Jenkinsfile VIM syntax highlighting
echo 'au BufNewFile,BufRead Jenkinsfile setf groovy' >> ~/.vimrc
@sighingnow
sighingnow / Makefile
Last active February 26, 2024 12:47
Detect operating system in Makefile.
# Detect operating system in Makefile.
# Author: He Tao
# Date: 2015-05-30
OSFLAG :=
ifeq ($(OS),Windows_NT)
OSFLAG += -D WIN32
ifeq ($(PROCESSOR_ARCHITECTURE),AMD64)
OSFLAG += -D AMD64
endif