Skip to content

Instantly share code, notes, and snippets.

Sébastien Stormacq sebsto

Block or report user

Report or block sebsto

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
sebsto / gist:19b99f1fa1f32cae5d00
Created Aug 8, 2014
Install Maven with Yum on Amazon Linux
View gist:19b99f1fa1f32cae5d00
sudo wget -O /etc/yum.repos.d/epel-apache-maven.repo
sudo sed -i s/\$releasever/6/g /etc/yum.repos.d/epel-apache-maven.repo
sudo yum install -y apache-maven
mvn --version
sebsto /
Created Nov 21, 2019
Delete Log groups
for NAME in $(aws logs describe-log-groups | jq -r .logGroups[].logGroupName | grep amplifynotes)
aws logs delete-log-group --log-group-name $NAME
sebsto / code-stack.ts
Last active Nov 20, 2019
CDK Create EC2 instace in private subnet. Install Nginx.
View code-stack.ts
import ec2 = require('@aws-cdk/aws-ec2');
import cdk = require('@aws-cdk/core');
import { Fn, Tag, Resource } from '@aws-cdk/core';
import { AmazonLinuxImage, UserData, InstanceType } from '@aws-cdk/aws-ec2';
import { Role, ServicePrincipal, ManagedPolicy, CfnInstanceProfile } from '@aws-cdk/aws-iam'
* Create my own Ec2 resource and Ec2 props as these are not yet defined in CDK
* These classes abstract low level details from CloudFormation
sebsto /
Created Nov 15, 2019
Amazon S3 - List all your buckets (aka 'ls' command)
import boto3
s3 = boto3.resource('s3')
for bucket in s3.buckets.all():
sebsto / batch-write-items.json
Created Oct 5, 2019
Amazon DynamoDB batch write
View batch-write-items.json
"demo-global-table": [
"PutRequest": {
"Item": {
"id": {"S": "0123456789"},
"firstname": {"S": "Jeff"},
"lastname": {"S": "Barr"}
sebsto / gist:468670c7c0d5feeade69
Created Mar 20, 2015
AWS CLI : discover your service limits from the command line
View gist:468670c7c0d5feeade69
aws support describe-trusted-advisor-check-result --check-id eW7HH0l7J9 --query 'result.sort_by(flaggedResources[?status!="ok"],&metadata[2])[].metadata' --output table --region us-east-1
sebsto /
Created May 4, 2019
Bien démarrer avec Amazon S3 et Python
import logging
import boto3
from botocore.exceptions import ClientError
def upload_file(file_name, bucket, object_name=None):
"""Upload a file to an S3 bucket
:param file_name: File to upload
:param bucket: Bucket to upload to
:param object_name: S3 object name. If not specified then file_name is used
sebsto / gist:20e550876db521710186
Created Feb 12, 2015
Block users access to AWS EC2 meta data
View gist:20e550876db521710186
sudo iptables -A OUTPUT -m owner ! --uid-owner root -d -j DROP
sebsto / gist:6441df09e97c4cbbd22b8ba313b8d642
Last active Aug 10, 2019
Amazon Linux 2 first boot on Virtual Box
View gist:6441df09e97c4cbbd22b8ba313b8d642
# Download the VDI from
# Doc is at
# Be sure you have config/meta-data and config/user-data ready as per the below
# change ec2-user's password to your password
$ cat config/meta-data
local-hostname: amazonlinux.onprem
# eth0 is the default network interface enabled in the image. You can configure
sebsto / menubar.swift
Created Jul 10, 2019
List MacOS MenuBar items
View menubar.swift
import Foundation
import CoreGraphics
let windowInfos = CGWindowListCopyWindowInfo(CGWindowListOption.optionOnScreenOnly, kCGNullWindowID) as! Array<CFDictionary>
for item in windowInfos {
if let dict = item as? [CFString: AnyObject] {
if ( dict[kCGWindowLayer] as! Int == 25 && dict[kCGWindowOwnerName] as! String != "SystemUIServer" ) {
print("StatusBar Item \(dict)")
You can’t perform that action at this time.