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
aws s3api list-objects --bucket %bucketname% --query 'sum(Contents[].Size)' --output json | awk 'BEGIN {total=0}{total+=$0}END{print total/1024/1024/1024" GB"}'
@anamorph
anamorph / index.html
Last active August 29, 2015 14:16
localPrayer
<html>
<head>
</head>
<body>
<table>
<tr>
<td class="location" rowspan="2">City</td>
<td class="prayerName">Fajr
<div class='prayerNameAr'>فجر</div>
@anamorph
anamorph / gist:baa70acf4cf06a96130e
Created April 21, 2015 10:25
Avoid SSH connection timeout quick fix
# in ~/.ssh/config
# you can set this host by host:
Host mysshbastion
HostName mysshbastion.cloud.infrastructu.re
ServerAliveInterval 120 # in seconds
# or globally:
Host *
@anamorph
anamorph / HOWTO Install Cacti on AWS EC2 Instance running Amazon Linux.md
Last active September 6, 2022 00:49
HOWTO Install Cacti on AWS EC2 Instance running Amazon Linux

0. First install the pre-reqs

0.1 Installing

yum install mysql-server mysql php-mysql php-pear php-common php-gd php-devel php php-mbstring php-cli php-snmp php-pear-Net-SMTP php-mysql httpd -y

0.2 Configuring services

chkconfig mysqld on
chkconfig httpd on
service mysqld start
service httpd start
@anamorph
anamorph / HOWTO Install AWS CLI on Debian.md
Last active July 30, 2022 09:50
HOWTO Install AWS CLI on Debian

HOWTO Install AWS CLI on Debian

1. installing pre-reqs

sudo apt-get install python python-pip

2. installing the cli:

sudo pip install awscli

3. configuring the cli:

aws configure
@anamorph
anamorph / public_key.sh
Created July 21, 2015 22:10
creating public key from private key
# generates public key form private key where
# $1 is the source private key
# $2 is the ouput public key
#
# created as a reminder ...
ssh-keygen -y -f $1 > $2
@anamorph
anamorph / NVRAM_reset.md
Last active October 31, 2018 14:19
NVRAM reset on HP LaserJet 400 colorMFP M475dn
  1. disconnect all cables, leave power cable connected.
  2. note the position of the "ready" message on the screen. It is located on the home screen, at the bottom right.
  3. power off the printer, using the power button.
  4. touch and hold where you have located the "ready" message in step 2.
  5. power on the printer while holding the screen.
  6. continue to hold while the printer is booting.
  7. after a few minutes, the printer will reboot. you can now unhold the screen.
  8. plug back all cables in their original location.
  9. you can now configure the printer again; it has successfully be resetted to its factory settings.
@anamorph
anamorph / HOWTO-Lightroom_sync_with_s3-windows-macos.md
Last active March 28, 2024 14:58
HOWTO Lightroom sync with s3 windows/macos

HOWTO Lightroom sync with s3 windows/macos

1. The pitch

As I am an avid photographer & travelling quite a lot, I wanted to sync my Adobe Lightroom library from Macbook to my Microsoft Windows desktop at home with very little/no human intervention. It is also a good thing that both Lightroom versions (mac & windows) share a common file system/structure, this helped alot in synchronizing data from one environment to another.

This HOWTO assumes you already have an AWS account created and running with an IAM user configured.

Put together, the solution would look as such (pardon my poor diagram skills):

                                  _  
macbook pro                     (`  ).                     windows desktop
@anamorph
anamorph / my-lightroom-policy.json
Created September 22, 2015 09:29
HOWTO Lightroom sync with s3 windows/macos - Lightroom Policy
{
"Id": "Policy1442860910448",
"Version": "2012-10-17",
"Statement": [
{
"Sid": "Stmt1442860826662",
"Action": [
"s3:ListBucket"
],
"Effect": "Allow",
@anamorph
anamorph / cleanup_s3_bucket.sh
Created October 18, 2015 23:21
recursively deletes all objects in a bucket
# recursively deletes all objects in a bucket where
# $1 is the bucket name
#
# created as a reminder ...
aws s3 rm --recursive s3://$1