Skip to content

Instantly share code, notes, and snippets.

View jay-johnson's full-sized avatar

Jay jay-johnson

View GitHub Profile
@ashwin
ashwin / RandomFloat.py
Created May 3, 2012 10:57
Generate random float in Python
import random
# Random float in [0.0, 1.0)
a = random.random()
# Random float in [0, 100]
b = random.uniform( 0, 100 )
@oubiwann
oubiwann / list_queues.txt
Created October 5, 2012 23:18
A Kombu send/receive example
Listing queues ...
hipri 5
lopri 0
midpri 0
...done.
@mikedilger
mikedilger / Cargo.toml
Last active May 10, 2022 01:49
Using hyper and rustls
[package]
name = "example"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
anyhow = { version = "1.0", features = [ "backtrace" ] }
futures = "0.3"
@tadeck
tadeck / myip.py
Created August 18, 2012 19:59
Python script for getting public IP address
#!/usr/bin/env python
"""
This simple script fetches your IP as seen by web pages, and displays it.
Execute this script locally like that:
$ curl -s https://raw.github.com/gist/3389407/myip.py | python
"""
import urllib2
@jnaulty
jnaulty / virt-install-centos
Created March 18, 2018 00:36 — forked from giovtorres/virt-install-centos
Install CentOS cloud images on KVM using cloud-init
#!/bin/bash
## **Updates to this file are now at https://github.com/giovtorres/kvm-install-vm.**
## **This updated version has more options and less hardcoded variables.**
# Take one argument from the commandline: VM name
if ! [ $# -eq 1 ]; then
echo "Usage: $0 <node-name>"
exit 1
fi
@VigneshChennai
VigneshChennai / variance.rs
Last active July 26, 2022 15:40
Covariant and Invariant - Rust Example
struct CovariantExample<'a, T> {
a: &'a T
}
struct InvariantExample<'a, T> {
a: &'a mut T
}
fn covarient() {
@pauloconnor
pauloconnor / gist:4707710
Last active December 1, 2022 09:33
Logstash Mutate Filter for stripping Linux color codes from log files
# Get rid of color codes
mutate {
gsub => ["message", "\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]", ""]
}
@andrewstuart
andrewstuart / .gitlab-ci.yml
Last active June 12, 2023 17:44
One Deployment Per branch, plus CI CD, gitlab and helm setup
image: docker.mydomain.com/build/kube-go-make
variables:
DOCKER_TAG: docker.mydomain.com/myapp/home:$CI_COMMIT_REF_SLUG
DOCKER_HOST: tcp://localhost:2375
DOCKER_DRIVER: overlay
PROD_RSYNC_HOST: myprodserver.com
DOMAIN: mydomain.com
CHART_DIR: chart
@pahud
pahud / main.workflow
Last active July 24, 2023 08:20
Github Actions with Amazon EKS CI/CD
workflow "Demo workflow" {
on = "push"
resolves = ["SNS Notification"]
}
action "Build Image" {
uses = "actions/docker/cli@c08a5fc9e0286844156fefff2c141072048141f6"
runs = ["/bin/sh", "-c", "docker build -t $IMAGE_URI ."]
env = {
IMAGE_URI = "xxxxxxxx.dkr.ecr.ap-northeast-1.amazonaws.com/github-action-demo:latest"
@DmZ
DmZ / pre-commit
Last active July 25, 2023 13:40
Git pre-commit hook to search for Amazon AWS API keys.
#!/bin/sh
if git rev-parse --verify HEAD >/dev/null 2>&1
then
against=HEAD
else
# Initial commit: diff against an empty tree object
against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
fi