Skip to content

Instantly share code, notes, and snippets.

View anamorph's full-sized avatar
🇧🇭
Hello from sunny Bahrain !

Nicolas David anamorph

🇧🇭
Hello from sunny Bahrain !
View GitHub Profile
@anamorph
anamorph / check_unattached_EIPs.sh
Created January 8, 2024 08:59
[aws] List all the Unattached Elastic IP addresses in all of the Opted-In Regions
#!/bin/sh
# id: check_unattached_EIPs.sh
# author: nicolas david - nicolas@openlab.fr
#
## version history:
# ----------------------------------------------------------------------------
# v1.0 nicolas@ Initial Version
#
# ----------------------------------------------------------------------------
@anamorph
anamorph / compresspdf.sh
Created June 23, 2021 07:32
Creates an alias to compress (quick & dirty) pdfs via the terminal
# pre-reqs:
# ghostscript -> brew install ghostscript
function compresspdf {
INPUT_FILE=$1
FILE_EXTENSION="${INPUT_FILE##*.}"
FILE_NAME="${INPUT_FILE%.*}"
OUTPUT_FILE="$FILE_NAME-compressed.$FILE_EXTENSION"
gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/ebook -dColorImageResolution=150 -dNOPAUSE -dQUIET -dBATCH -sOutputFile=$OUTPUT_FILE $INPUT_FILE
}
@anamorph
anamorph / gist:46039fa8a4e2c1ac96875bd435a9f681
Created March 21, 2021 12:09
Installing AWS CLI v2 on raspian
pip3 install https://github.com/boto/botocore/zipball/v2#egg=botocore --upgrade
pip3 install -r requirements.txt
pip3 install .
@anamorph
anamorph / addmy32.sh
Created January 6, 2019 08:15
adds your /32 to your dev ec2 security group.
#!/bin/bash
export MY_32CIDR=$(curl -s v4.ifconfig.co)/32
aws ec2 authorize-security-group-ingress --group-id sg-{yoursgid} --protocol tcp --port 22 --cidr $MY_32CIDR
@anamorph
anamorph / virt-manager_on_macosx.md
Last active March 14, 2024 01:27
How to install Virt Manager on MacOS X to manage my lab vms at home :-)

based on https://github.com/jeffreywildman/homebrew-virt-manager/

let's tap into Jeffrey's repo

brew tap jeffreywildman/homebrew-virt-manager

installing py2cairo as it is required for py3cairo (?!)

brew install py2cairo

now installing virt-manager & virt-viewer

brew install virt-manager virt-viewer

installing xquartz

brew cask install xquartz

@anamorph
anamorph / CreateCloudTrailLogBucket.yaml
Last active February 8, 2018 18:18
Creates an s3 bucket with a LifecyclePolicy moving files to Glacier after 1 year and deleting them after 5 years. This also creates a BucketPolicy to make sure only CloudTrail can write to the bucket. I use this scenario for log collection and analysis.
Description:
This template creates an s3 Bucket for CloudTrail logs; it is set up with
the appropriate bucket policies defined to receive logs only from CloudTrail.
It also includes a LifecyclePolicy moving files to Glacier after 1 year.
Parameters:
EnvironmentName:
Description:
An environment name that will be used for tags.
@anamorph
anamorph / gist:b861de7f06835eaee54177b3abd830c0
Created November 18, 2017 12:28
Build GCC 4.9.2 for C/C++ in CentOS 7
sudo yum install libmpc-devel mpfr-devel gmp-devel
sudo yum groupinstall "Development tools"
cd /tmp
curl ftp://ftp.mirrorservice.org/sites/sourceware.org/pub/gcc/releases/gcc-4.9.2/gcc-4.9.2.tar.bz2 -O
tar xvfj gcc-4.9.2.tar.bz2
cd gcc-4.9.2
./configure --disable-multilib --enable-languages=c,c++
make -j 4
@anamorph
anamorph / list_amazon-linux-AMI.sh
Created April 5, 2017 13:41
Listing all Amazon Linux AMI ever, full #AWS #CLI
aws ec2 describe-images --owners amazon --query 'reverse(sort_by(Images[*].{Id:ImageId,Type:VirtualizationType,Created:CreationDate,Storage:RootDeviceType, Desc:Description}, &Created))' --filters "Name=description,Values=Amazon Linux AMI*" --output table
@anamorph
anamorph / .gitignore
Last active January 26, 2016 09:28 — forked from octocat/.gitignore
Some common .gitignore configurations
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
@anamorph
anamorph / OpenBSD-install-awscli_aws-shell.txt
Last active August 23, 2022 07:21
OpenBSD-install-awscli_aws-shell
# uname -a
OpenBSD foo.openlab.fr 5.8 GENERIC#1170 amd64
# export PKG_PATH=http://ftp2.fr.openbsd.org/pub/OpenBSD/`uname -r`/packages/`arch -s`/
# pkg_add python
quirks-2.114 signed on 2015-08-09T11:57:52Z
quirks-2.114: ok
Ambiguous: choose package for python
a 0: <None>
1: python-2.7.10
2: python-3.4.3