Skip to content

Instantly share code, notes, and snippets.

View chrismckinnel's full-sized avatar

Chris McKinnel chrismckinnel

View GitHub Profile
function _forward_mysql_via_ssh() {
CMD_START="ssh"
CMD_END=" -f $1 -L $2:$3:3306 -N"
CMD="$CMD_START $CMD_END"
eval $CMD
}
function forward-dashboard-dev-mysql() {
PORT=8806
_forward_mysql_via_ssh toolkit-apps-dev.tangentlabs.co.uk $PORT 192.168.125.23
@chrismckinnel
chrismckinnel / gist:d23a82b620c4b4d0d93b
Created July 14, 2015 13:51
Better connections in boto2

So this thing:

class BotoConnection(object):

    def __new__(cls, profile_name, services):
        if not hasattr(cls, '__instance__'):
            cls.__instance__ = super(BotoConnection, cls)\
                .__new__(cls, profile_name, services)
events {
worker_connections 1024;
}
http {
upstream elasticsearch {
server 127.0.0.1:9200;
keepalive 15;
#! /bin/bash
./pan.sh \
/rep:"kettle-dev-repo" \
/trans:"lab-data-csv-to-postgresql" \
/user:admin \
/pass:********************** \
/param:LABS_DATA_CSV_FILE=/opt/labs-data.csv \
/level:Basic
Set fileSystemObject = CreateObject ("Scripting.FileSystemObject")
Set stdout = fileSystemObject.GetStandardStream (1)
Set stderr = fileSystemObject.GetStandardStream (2)
Function ExportAccessToCSV()
stdout.WriteLine "Exporting Access table " & table & " to CSV"
Dim database: database = WScript.Arguments(0)
Dim table: table = WScript.Arguments(1)
Set wshShell = WScript.CreateObject("WScript.Shell")
@chrismckinnel
chrismckinnel / hello_world app.py
Created May 29, 2019 02:38
Import PTVSD and set up a python debugger
import ptvsd
ptvsd.enable_attach(address=(‘0.0.0.0’, 5890), redirect_output=True)
ptvsd.wait_for_attach()
@chrismckinnel
chrismckinnel / launch.json
Created May 29, 2019 02:39
Visual code debugging config for Python attaching to a running process
{
"version": "0.2.0",
"configurations": [
{
"name": "SAM CLI Python Hello World",
"type": "python",
"request": "attach",
"port": 5890,
"host": "127.0.0.1",
"pathMappings": [
AWSTemplateFormatVersion: '2010-09-09'
Resources:
RedirectLambdaBucket:
Type: AWS::S3::Bucket
Outputs:
RedirectLambdaBucketName:
Description: Redirect lambda package S3 bucket name
Value: !Ref RedirectLambdaBucket
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: Full stack to demo Lambda@Edge for CloudFront redirects
Parameters:
RedirectLambdaName:
Type: String
Default: redirect-lambda
Resources:
RedirectLambdaFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: lambdas/
FunctionName: !Ref RedirectLambdaName
Handler: RedirectLambda.handler
Role: !GetAtt RedirectLambdaFunctionRole.Arn
Runtime: nodejs10.x
AutoPublishAlias: live