Skip to content

Instantly share code, notes, and snippets.

View potter0815's full-sized avatar

Christoph Schmitter potter0815

View GitHub Profile
@gregoryyoung
gregoryyoung / gist:1500720
Created December 20, 2011 08:00
Greg's Stop Loss Kata
Greg's Stop Loss Kata
Testing is very hard when time is involved ...
A trailing stop loss is a term used in financial trading. For a very in depth explanation you can read here http://www.investopedia.com/articles/trading/03/080603.asp and http://en.wikipedia.org/wiki/Order_(exchange)#Stop_orders
However we do not need a huge amount of background in order to do the kata as we are going to limit the problem a bit.
The general idea is that when you buy into a stock at a price say $10. You want it to automatically get sold if the stock goes below $9 (-$1). If we use the term "trailing" that means that id the price goes up to $11 then the sell point becomes $10.
@dakatsuka
dakatsuka / fluentd.conf
Created April 11, 2012 06:46
fluentd upstart script
description "Fluentd"
start on runlevel [2345]
stop on runlevel [016]
respawn
respawn limit 5 60
exec sudo -u fluentd /opt/fluentd/usr/bin/fluentd -c /opt/fluentd/etc/fluent.conf --log /opt/fluentd/var/log/fluentd.log
@PavelChernyak
PavelChernyak / gist:3406124
Created August 20, 2012 17:52 — forked from danielocallaghan/gist:1016161
NR RUM details
//header
<script>
var NREUMQ=[];NREUMQ.push(["mark","firstbyte",new Date().getTime()]);
(function(){var d=document;var e=d.createElement("script"); e.type="text/javascript"; e.async=true;e.src="https://d7p9czrvs14ne.cloudfront.net/10/eum/rum.js";
var s=d.getElementsByTagName("script")[0];s.parentNode.insertBefore(e,s);})()
</script>
// footer
<script type="text/javascript" charset="utf-8">
NREUMQ.push(["nrf2","beacon-1.newrelic.com","api-key",appID,"cV5eEkBfCF1WRBgECFZEQwNAbwVBQ1peAgdGWF8IQR8LR1ZEQQgDRQ==",6,707])
@grenade
grenade / 01-generate-ed25519-ssh-key.sh
Last active July 11, 2024 10:06
generate ed25519 ssh and gpg/pgp keys and set file permissions for ssh keys and config
#!/bin/bash
# generate new personal ed25519 ssh keys
ssh-keygen -o -a 100 -t ed25519 -f ~/.ssh/id_ed25519 -C "rob thijssen <rthijssen@gmail.com>"
ssh-keygen -o -a 100 -t ed25519 -f ~/.ssh/id_robtn -C "rob thijssen <rob@rob.tn>"
# generate new host cert authority (host_ca) ed25519 ssh key
# used for signing host keys and creating host certs
ssh-keygen -t ed25519 -f manta_host_ca -C manta.network
@s0enke
s0enke / README.md
Last active May 12, 2023 14:21
Dashing Cloudwatch

This is an adjusted version of EC2 CloudWatch stats for Dashing which is not bound to EC2 metrics but a generic widget for cloudwatch graphs. Visualization is done by Rickshawgraph as in the original example.

@teknogeek0
teknogeek0 / elb2s3failover.template
Created November 7, 2014 22:10
For Re:Invent 2014, Deployment Automation talk - ELB to S3 Website "Fail Whale" failover CloudFormation template
{
"AWSTemplateFormatVersion" : "2010-09-09",
"Description" : "Create a Route53 Fail Whale failover setup from ELB to S3. You need a preexisting ELB, S3 bucket configured as a Website endpoint, and Hosted Zone.",
"Parameters" : {
"ELBDnsName" : {
"Type" : "String",
"Description" : "Your ELB's DNS Name"
},
@innovia
innovia / lambda-concurrency-to-cloudwatch.py
Created December 17, 2017 09:30
Lambda concurrent execution custom metric on CloudWatch
#!/usr/bin/env python
import boto3
import datetime
import time
ENABLED_REGIONS = [
"us-east-1",
"us-west-2",
"eu-west-1",
"eu-central-1",
@mbaitelman
mbaitelman / README.md
Last active February 20, 2024 22:31
Automated Terraform Deployments Using Bitbucket Pipelines
@lounagen
lounagen / readme.md
Last active April 12, 2023 00:43 — forked from thomasdarimont/readme.md
Example for decoding a JWT Payload with your Shell (bash, zsh...)

Setup

Add this to your .profile, .bashrc, .zshrc...

BASE64_DECODER_PARAM="-d" # option -d for Linux base64 tool
echo AAAA | base64 -d > /dev/null 2>&1 || BASE64_DECODER_PARAM="-D" # option -D on MacOS

decode_base64_url() {
  local len=$((${#1} % 4))
  local result="$1"
 if [ $len -eq 2 ]; then result="$1"'=='
@ejdoh1
ejdoh1 / run.sh
Last active December 11, 2023 21:43
AWS SSM Agent Raspberry Pi Installation
# AWS SSM Agent RPi Installation
# First get an SSM agent activate code
# - Login to the AWS web console and browse to the AWS Systems Manager service (SSM).
# - Under Instances & Nodes, select Hybrid Activations
# - Select 'Create activation', fill-out the form and get an activation code
# Login to your server via SSH and run the following commans, entering the code, id and region values
mkdir /tmp/ssm
sudo curl https://s3.amazonaws.com/ec2-downloads-windows/SSMAgent/latest/debian_arm/amazon-ssm-agent.deb -o /tmp/ssm/amazon-ssm-agent.deb