Skip to content

Instantly share code, notes, and snippets.

View saidsef's full-sized avatar
👻
Building stuff

Said Sef saidsef

👻
Building stuff
View GitHub Profile
@saidsef
saidsef / polly.py
Last active January 15, 2018 03:44
AWS Polly - Read to me
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2018, Said Sef. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
import boto3
import tempfile
import logging
from voices import Voices
@saidsef
saidsef / app.py
Last active January 15, 2018 03:43
Flask API - Available Endpoints
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2018, Said Sef. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
from flask import Flask, jsonify
app = Flask(__name__)
@saidsef
saidsef / extract.groovy
Last active August 23, 2017 21:27
Groovy! - Read pom.xml File
#!/usr/bin/env groovy
import java.util.*
import groovy.util.XmlParser
def pom = new File('pom.xml').getText('utf-8')
def doc = new XmlParser().parseText(pom)
def version = doc.version.text()
println(version)
@saidsef
saidsef / hcl_tf_iam_role_policy.py
Last active January 15, 2018 03:43
Print IAM Role Policy as YAML
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2018, Said Sef. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
__author__ = 'Said Sef'
import hcl
import json
import yaml
import org.jsoup.Jsoup
def document = Jsoup.connect('https://api.github.com/repos/saidsef/alpine-jenkins-dockerfile-demo/releases/latest')ignoreContentType(true).execute().body()
def json = new groovy.json.JsonSlurper().parseText(document)
println(json.tag_name)
@saidsef
saidsef / magic_mouse.py
Last active January 15, 2018 03:43
Magic Mouse - Keep awake
#!/usr/bin/env python
# Copyright (c) 2018, Said Sef. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
##
# You'll need to install pynput
# pip install pynput
##
from pynput.mouse import Button, Controller, Listener
@saidsef
saidsef / lambda_cpu_cores.md
Last active February 13, 2024 13:57
AWS Lambda CPU Cores
@saidsef
saidsef / meminfo.py
Last active October 8, 2020 08:51
Get total physical memory in Python
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2018, Said Sef. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
class Meminfo(object):
def __init__(self):
''' Initialize Meminfo class '''
@saidsef
saidsef / apigw_swagger.json
Last active March 7, 2018 21:24
AWS API Gateway VPC Link - Swagger
{
"swagger": "2.0",
"info": {
"version": "2017-11-17T04:40:23Z",
"title": "TestVPCLink"
},
"basePath": "/",
"schemes": [
"https"
],