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 / code-stack.ts
Last active Aug 29, 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 / 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)")
sebsto / async4.js
Created Jun 25, 2019
Async - AWS SDK for Javascript
View async4.js
function updatePlayCount(your_object) {
return new Promise((resolve, reject) => {
const LAST_PLAYED_TIME = Math.round(new Date() / 1000);
var params = {
TableName: "your_table",
Key: {
"cognitoid": your_object.userId,
sebsto / async3.js
Created Jun 25, 2019
Async - the good
View async3.js
async function asyncWorker() {
return new Promise( (resolve, reject) => {
setTimeout(resolve, 2000);
async function main() {
sebsto / async2.js
Created Jun 25, 2019
Async - the bad
View async2.js
function asyncWorker() {
return new Promise( (resolve, reject) => {
setTimeout(resolve, 2000);
function main() {
callback = () => {
sebsto / async1.js
Created Jun 25, 2019
Async - the ugly
View async1.js
function asyncWorker(callback) {
setTimeout(callback, 2000);
function main() {
callback = () => {
console.debug('callback !');
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 / appsync_tls_3.js
Created Jan 20, 2019
AppSync client creation with custom OKHTTP Client
View appsync_tls_3.js
// tm is the trust manager, code to instantiate this is skipped for brevity
// let's create our own OKHttpClient and configure it to use our custom SSLSocketFactory
val okHTTPClient = OkHttpClient.Builder().sslSocketFactory(TLSSocketFactory(), tm).build()
// Tell the builder to use our own OK HTTP client
appSyncClient =
sebsto / appsync_tls_2.js
Created Jan 20, 2019
appsync client creation by default
View appsync_tls_2.js
// initialize the AppSync client
val appSyncClient = AWSAppSyncClient.builder()
sebsto /
Created Jan 20, 2019
$ nmap --script ssl-enum-ciphers <your_appsync_id>
Starting Nmap 7.70 ( ) at 2018-12-23 14:35 GMT
Nmap scan report for (13.xx.xx.43)
Host is up (0.033s latency).
Other addresses for (not scanned): 13.xx.xx.xx 13.xx.xx.xx 13.xx.xx.xx
rDNS record for 13.xx.xx.43:
Not shown: 998 filtered ports
80/tcp open http
You can’t perform that action at this time.