Skip to content

Instantly share code, notes, and snippets.

View russellballestrini's full-sized avatar
💭
https://www.makepostsell.com

Russell russellballestrini

💭
https://www.makepostsell.com
View GitHub Profile
@russellballestrini
russellballestrini / sts2env
Last active August 2, 2022 14:37
Configure your shell with temporary AWS environment variables from
#!/usr/bin/env python
"""
How to use:
eval $(eval "aws sts assume-role --role-arn arn:aws:iam::0123456789:role/the-role-name --role-session-name my-aws-prod | ./sts2env")
Then run `env` and you should see the environment vars in your shell.
"""
@lbernail
lbernail / ebsnvme-id
Created April 26, 2018 15:07
ebsnvme-id script
#!/usr/bin/env python2.7
# Copyright (C) 2017 Amazon.com, Inc. or its affiliates.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License").
# You may not use this file except in compliance with the License.
# A copy of the License is located at
#
# http://aws.amazon.com/apache2.0/
@gleicon
gleicon / list_objects_google_storage_boto3.py
Last active October 11, 2023 14:27
How to use boto3 with google cloud storage and python to emulate s3 access.
from boto3.session import Session
from botocore.client import Config
from botocore.handlers import set_list_objects_encoding_type_url
import boto3
ACCESS_KEY = "xx"
SECRET_KEY = "yy"
boto3.set_stream_logger('')
@brianbruggeman
brianbruggeman / LICENSE
Last active January 18, 2024 17:42
Convert Viscosity to Open VPN
Public Domain
@oztune
oztune / linkpeek.js
Last active December 11, 2015 02:10
Node.js script for generating Link Peek urls
function linkPeek(apiKey, secret) {
return function getUrl(uri, queryParams) {
queryParams = Object.assign({
size: 'original'
}, queryParams)
const token = md5(secret + uri + queryParams.size)
const extraParams = queryParams && Object.keys(queryParams).map(param => `${param}=${encodeURIComponent(queryParams[param])}`).join('&')
return `https://linkpeek.com/api/v1?uri=${encodeURIComponent(uri)}&apikey=${apiKey}&token=${token}${extraParams ? `&${extraParams}` : ''}`
@mmerickel
mmerickel / cors.py
Last active December 6, 2022 14:13
cors in pyramid
from pyramid.security import NO_PERMISSION_REQUIRED
def includeme(config):
config.add_directive(
'add_cors_preflight_handler', add_cors_preflight_handler)
config.add_route_predicate('cors_preflight', CorsPreflightPredicate)
config.add_subscriber(add_cors_to_response, 'pyramid.events.NewResponse')
class CorsPreflightPredicate(object):
@pypt
pypt / pyyaml-duplicates.py
Created September 9, 2015 22:10
PyYAML: raise exception on duplicate keys on the same document hierarchy level
import yaml
from yaml.constructor import ConstructorError
try:
from yaml import CLoader as Loader
except ImportError:
from yaml import Loader
def no_duplicates_constructor(loader, node, deep=False):
@elsonrodriguez
elsonrodriguez / README.md
Last active October 17, 2023 14:21
Selenium on Kubernetes!

This is a quick and dirty guide on how to deploy Selenium on Kubernetes.

It is required that you have Kubernetes cluster up and running. If you don't have one, GKE is pretty nifty: https://cloud.google.com/container-engine/

Deploy the Seleniumb Hub:

kubectl create -f selenium-hub-rc.yaml
kubectl create -f selenium-hub-svc.yaml
@ericrasmussen
ericrasmussen / users.idr
Created May 3, 2014 20:02
Contrived user history example to show off dependent types
module main
{-
I assume you're coming here from
http://chromaticleaves.com/posts/idris-and-dependent-types.html
If not, please take a moment to read it. It's a very important white paper.
Completely serious, too.
Now that we have that out of the way, this gist is a contrived example that
@rodacato
rodacato / notes.txt
Created September 19, 2013 03:28
Things you need to know when install piwik on smartos
# Congifuration Files
vi /opt/local/etc/php.ini
vi /opt/local/etc/php-fpm.conf
vi /opt/local/etc/nginx/nginx.conf
# Restart services
svcadm [refresh|restart|enable|disable] nginx
svcadm [refresh|restart|enable|disable] php-fpm