- Related Setup: https://gist.github.com/hofmannsven/6814278
- Related Pro Tips: https://ochronus.com/git-tips-from-the-trenches/
- Interactive Beginners Tutorial: http://try.github.io/
- Git Cheatsheet by GitHub: https://services.github.com/on-demand/downloads/github-git-cheat-sheet/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
exports.handler = (event, context, callback) => { | |
// Get request and request headers | |
const request = event.Records[0].cf.request; | |
const headers = request.headers; | |
// Configure authentication | |
const authUser = 'user'; | |
const authPass = 'pass'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
global | |
chroot /var/lib/haproxy | |
crt-base /etc/pki/tls/certs | |
daemon | |
group haproxy | |
log 127.0.0.1 local0 | |
maxconn 2000 | |
pidfile /var/run/haproxy.pid | |
stats socket /var/lib/haproxy/stats | |
tune.ssl.default-dh-param 2048 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# !/bin/bash | |
# Copyright (c) 2011 Float Mobile Learning | |
# http://www.floatlearning.com/ | |
# | |
# Extended by Ronan O Ciosoig January 2012 | |
# | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining | |
# a copy of this software and associated documentation files (the "Software"), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import jenkins.model.* | |
import com.cloudbees.plugins.credentials.* | |
import com.cloudbees.plugins.credentials.common.* | |
import com.cloudbees.plugins.credentials.domains.* | |
import com.cloudbees.plugins.credentials.impl.* | |
import com.cloudbees.jenkins.plugins.sshcredentials.impl.* | |
import org.jenkinsci.plugins.plaincredentials.* | |
import org.jenkinsci.plugins.plaincredentials.impl.* | |
import hudson.util.Secret | |
import hudson.plugins.sshslaves.* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Steps for installing the Android Emulator from EC2 console: | |
----------------------------------------------------------- | |
sudo apt install default-jdk | |
wget https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip | |
unzip sdk-tools-linux-4333796.zip -d android-sdk | |
sudo mv android-sdk /opt/ | |
export ANDROID_SDK_ROOT=/opt/android-sdk | |
echo "export ANDROID_SDK_ROOT=/opt/android-sdk" >> ~/.bashrc | |
echo "export PATH=$PATH:$ANDROID_SDK_ROOT/tools" >> ~/.bashrc | |
re-login |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Took this: | |
# https://s3.amazonaws.com/awsiammedia/public/sample/SAMLAPICLIADFS/samlapi_formauth_adfs3.py | |
# converted to boto3 and smooshed it together with this: | |
# https://gist.github.com/kapilt/ac8e222081f63ba64e93 | |
# which gave birth too this: | |
import sys | |
import botocore | |
import boto3 | |
import requests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from botocore.credentials import RefreshableCredentials | |
from botocore.session import get_session | |
from boto3 import Session | |
def assumed_session(role_arn, session_name, session=None): | |
"""STS Role assume a boto3.Session | |
With automatic credential renewal. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
def replace(string, substitutions): | |
substrings = sorted(substitutions, key=len, reverse=True) | |
regex = re.compile('|'.join(map(re.escape, substrings))) | |
return regex.sub(lambda match: substitutions[match.group(0)], string) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
arr = np.array(range(1000)).reshape(2,5,2,10,-1) | |
print(arr[:,:,:,3,2] == arr[...,3,2]) | |
# [[[ True, True], | |
# [ True, True], | |
# [ True, True], | |
# [ True, True], | |
# [ True, True]], | |
# [[ True, True], | |
# [ True, True], | |
# [ True, True], |
OlderNewer