Skip to content

Instantly share code, notes, and snippets.

View JonGilmore's full-sized avatar

Jon Gilmore JonGilmore

View GitHub Profile
@nitrocode
nitrocode / README.md
Last active December 30, 2022 23:43
Cloud custodian iam policy and role generated from code and outputted to terraform

CloudCustodian IAM Policy

Extracts perms from cloud-custodian repo, sanitizes extracted data, and transforms into terraform.

How it works

The code will

  1. search for permissions = (get this data) over multiline
  2. print only the captured group
@jtroberts83
jtroberts83 / c7n-iam-user-tag-enforce-policies.yaml
Last active August 21, 2020 12:47
Cloud Custodian IAM User Tag Enforcement Example
policies:
###################################################
### First Tag the Creator of the IAM User #####
###################################################
- name: iam-auto-tag-user
resource: iam-user
mode:
packages: [boto3, botocore, urllib3]
@staaldraad
staaldraad / awk_netstat.sh
Last active April 3, 2024 07:01
AWK to get details from /proc/net/tcp and /proc/net/udp when netstat and lsof are not available
# Gawk version
# Remote
grep -v "rem_address" /proc/net/tcp | awk '{x=strtonum("0x"substr($3,index($3,":")-2,2)); for (i=5; i>0; i-=2) x = x"."strtonum("0x"substr($3,i,2))}{print x":"strtonum("0x"substr($3,index($3,":")+1,4))}'
# Local
grep -v "rem_address" /proc/net/tcp | awk '{x=strtonum("0x"substr($2,index($2,":")-2,2)); for (i=5; i>0; i-=2) x = x"."strtonum("0x"substr($2,i,2))}{print x":"strtonum("0x"substr($2,index($2,":")+1,4))}'
# No Gawk
# Local
grep -v "rem_address" /proc/net/tcp | awk 'function hextodec(str,ret,n,i,k,c){
@gboddin
gboddin / 00-MINING.md
Last active January 27, 2024 11:58
Mining optimisation under Linux

Mining under linux

Disclaimer

I'm in no case responsible for fried hardware, erased software or burning down houses. Make sure your miners are always well cooled.

General recommendation

Though you can easily mix nVidia and AMD in the same rig with Linux, it's recommended to use a different thread for each platform so a Driver crash doesn't bring the whole rig down. It should be noted however, that some mining software have trouble when both architecture are found on the same rig.

@480
480 / gist:3b41f449686a089f34edb45d00672f28
Last active April 11, 2024 23:56
MacOS X + oh my zsh + powerline fonts + visual studio code terminal settings

MacOS X + oh my zsh + powerline fonts + visual studio code (vscode) terminal settings

Thank you everybody, Your comments makes it better

Install oh my zsh

http://ohmyz.sh/

sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
@abdullah353
abdullah353 / .gitlab-ci.yml
Created July 15, 2017 11:20
Basic skeleton of Gitlab CI integration with AWS Lambda for auto deployments.
image: docker:latest
before_script:
- apt-get update -y # Updating the Ubuntu Docker instance.
- python -V # Print out python version for debugging.
- apt install -y zip jq
- pip install awscli --upgrade --user
- export PATH=~/.local/bin:$PATH # Required for awscli.
- aws --version # Print out aws cli version for debugging.