Skip to content

Instantly share code, notes, and snippets.

View Hammond95's full-sized avatar

Martin Hammond95

View GitHub Profile
@glnds
glnds / aws-transfer-sftp.yaml
Last active February 23, 2024 09:53
CloudFormation template for AWS Transfer for SFTP
---
AWSTemplateFormatVersion: '2010-09-09'
Description: some-sftp-server
Parameters:
HostedZoneIdParam:
Type: String
Description: Hosted Zone ID
SFTPHostnameParam:
Type: String
@afranzi
afranzi / IamAuthenticator.scala
Created June 19, 2018 15:00
Presto - IamAuthenticator
/*
* Copyright (c) 2018 Schibsted Media Group. All rights reserved
*/
package com.saas.presto.access.authentication
import java.security.Principal
import java.util.concurrent.TimeUnit.MILLISECONDS
import com.facebook.presto.spi.security.{AccessDeniedException, BasicPrincipal, PasswordAuthenticator}
import com.google.common.cache.{CacheBuilder, CacheLoader, LoadingCache}
from pyhive import presto
import requests
from requests.auth import HTTPBasicAuth
import pandas as pd
requests.packages.urllib3.disable_warnings()
req_kw = {
'auth': HTTPBasicAuth('the-user', 'the-password'),
'verify': '/path/to/cert.pem',
}
@dasgoll
dasgoll / gist:a92575f7bcd2f855d96accb45f523025
Created December 4, 2017 11:01
install ansible on AWS EMR nodes
yum-config-manager --enable epel
yum - y install ansible
@frumbert
frumbert / tab-title-marquee.html
Created October 27, 2017 00:05
Make a marquee on the browser title
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>argh!</title>
<script type="text/javascript">
message = "The quick brown 🦊 jumps over the lazy 🐶 ";
function step() {
message = message.substr(1) + message.substr(0,1);
document.title = message.substr(0,15);
@arikfr
arikfr / example.py
Created September 11, 2017 07:31
Redash API usage example
import requests
class Redash(object):
def __init__(self, redash_url, api_key):
self.redash_url = redash_url
if not self.redash_url.endswith('/'):
self.redash_url = '{}/'.format(self.redash_url)
self.auth_headers = {'Authorization': 'Key {}'.format(api_key)}
@angelo-v
angelo-v / jwt-decode.sh
Last active July 12, 2024 09:51
Decode a JWT via command line
# will not work in all cases, see https://gist.github.com/angelo-v/e0208a18d455e2e6ea3c40ad637aac53#gistcomment-3439904
function jwt-decode() {
sed 's/\./\n/g' <<< $(cut -d. -f1,2 <<< $1) | base64 --decode | jq
}
JWT=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWV9.TJVA95OrM7E2cBab30RMHrHDcEfxjoYZgeFONFh7HgQ
jwt-decode $JWT
@semyont
semyont / luigi_server.cfg
Created June 14, 2017 14:53
luigi server config explained
[core]
# These parameters control core luigi behavior, such as error e-mails and
# interactions between the worker and scheduler.
default-scheduler-host: localhost
# Hostname of the machine running the scheduler. Defaults to localhost.
default-scheduler-port: 8082
# Port of the remote scheduler api process. Defaults to 8082.
@crazygit
crazygit / install_gnu_utilities.sh
Last active September 14, 2021 13:43
Use GNU Command Line Tools on macOS/OS X
# Refer: https://www.topbug.net/blog/2013/04/14/install-and-use-gnu-command-line-tools-in-mac-os-x/
brew install coreutils
brew tap homebrew/dupes
brew install binutils
brew install diffutils
brew install ed --with-default-names
brew install findutils --with-default-names
brew install gawk
brew install gnu-indent --with-default-names
brew install gnu-sed --with-default-names
@joyrexus
joyrexus / README.md
Last active February 24, 2024 15:16
collapsible markdown

collapsible markdown?

CLICK ME

yes, even hidden code blocks!

print("hello world!")