Skip to content

Instantly share code, notes, and snippets.

View fabsrc's full-sized avatar

Fabian Schneider fabsrc

  • Munich, Germany
View GitHub Profile
@fabsrc
fabsrc / docker-compose.yaml
Last active December 13, 2021 16:25
Grafana Alert Find Redirect Issue
version: "3"
services:
prometheus:
image: prom/prometheus:v2.31.1
ports:
- 9090:9090
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml:ro
- ./prometheus.rules.yml:/etc/prometheus/prometheus.rules.yml:ro
@fabsrc
fabsrc / .ebextensions#nginx.config
Created March 2, 2018 08:40
Add additional locations in Nginx reverse proxy for AWS Elastic Beanstalk
files:
"/tmp/add_default_nginx_includes.sh":
mode: "000755"
owner: root
group: root
content: |
#!/usr/bin/env bash
grep /etc/nginx/default.d /tmp/deployment/config/#etc#nginx#conf.d#00_elastic_beanstalk_proxy.conf > /dev/null 2>&1
if [ $? -eq 1 ]
then
@fabsrc
fabsrc / colorLog.js
Created January 7, 2018 09:55
Colored console output for the browser
log = new Proxy({}, {get: (x, k) => (...pass) => console.log(`%c${pass.join(' ')}`, `color: ${k}`)})
// log.red('ALARM')
// log.salmon('hello world')
// log.green('OK')
@fabsrc
fabsrc / docker-compose.yml
Created December 24, 2017 02:28
Drone with Gogs Docker Compose configuration
version: '2'
services:
drone-server:
image: drone/drone:latest
restart: unless-stopped
volumes:
- volume:/var/lib/drone/
environment:
- GIN_MODE=release
@fabsrc
fabsrc / coins.js
Last active March 16, 2019 09:11
Coin Golf
r=i=>{b=i*(d=100);[200,d,50,20,10,5,2,1].map(a=>{console.log(~~(b/a)+'x',a<d?a+'c':a/d+'€');b%=a})}
// Usage:
// r(1.56)
@fabsrc
fabsrc / index.js
Created October 31, 2017 16:03
Get Instagram URLs by hashtag
function getURLsByHashtag(hashtag) {
let count = 0
let urls = []
return (function makeRequest(maxId = '') {
return fetch(`https://www.instagram.com/explore/tags/${hashtag}/?__a=1&max_id=${maxId}`)
.then(res => res.json())
.then(res => {
console.log(++count)
@fabsrc
fabsrc / deploy_to_elasticbeanstalk.sh
Last active September 6, 2017 07:56
Package and deploy ElasticBeanstalk application to AWS
AWS_DEFAULT_REGION=__AWS_region__
APPLICATION_NAME=__EB_application_name__
ENVIRONMENT_NAME=__EB_environment_name__
VERSION_NAME=__EB_version_name__
FILENAME=$APPLICATION_NAME-$VERSION_NAME.zip
BUCKET=__S3_bucket_name__
TIMEOUT=__timeout__
# AWS_PROFILE=__AWS_local_profile__
AWS_ACCESS_KEY_ID=__AWS_access_key_id__
@fabsrc
fabsrc / upload_to_elasticbeanstalk.sh
Last active September 5, 2017 15:58
Package and upload ElasticBeanstalk application to AWS
AWS_DEFAULT_REGION=__AWS_region__
APPLICATION_NAME=__EB_application_name__
ENVIRONMENT_NAME=__EB_environment_name__
VERSION_NAME=__EB_version_name__
FILENAME=$APPLICATION_NAME-$VERSION_NAME.zip
BUCKET=__S3_bucket_name__
# AWS_PROFILE=__AWS_local_profile__
AWS_ACCESS_KEY_ID=__AWS_access_key_id__
AWS_SECRET_ACCESS_KEY__AWS_secret_access_key__
@fabsrc
fabsrc / restartTC7200.sh
Created July 28, 2017 11:29
Restart Technicolor TC7200 router
#! /bin/bash
IP="192.168.0.1"
USERNAME=
PASSWORD="admin"
# Create Basic Auth Credentials
CREDENTIALS="$(printf "$USERNAME:$PASSWORD" | base64)"
# Get CSRF token
@fabsrc
fabsrc / checkAndRestartRouter.sh
Last active November 4, 2021 18:49
Check internet connection and restart Technicolor TC7200 router
#! /bin/bash
IP="192.168.0.1"
USERNAME=
PASSWORD="admin"
FAILURE_THRESHOLD=10
SLEEP_TIME=5
function restart {
CREDENTIALS="$(printf "$USERNAME:$PASSWORD" | base64)"