Skip to content

Instantly share code, notes, and snippets.

@gianrubio
gianrubio / gist:67e4c360db5d09789612
Created November 15, 2014 15:13
Serving cloudfront gzip
http://blog.kenweiner.com/2009/08/serving-gzipped-javascript-files-from.html
find . -type f ! -name '*.gz' -exec gzip "{}" \;
@gianrubio
gianrubio / gist:4b42ec7f55317422ef86
Created June 15, 2015 21:52
Randoms Secret Key
from django.utils.crypto import get_random_string
chars = 'abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'
get_random_string(50, chars)
#!/bin/bash
#source https://raw.githubusercontent.com/Springest/elastic-beanstalk-deploy-notifications/bb9f1f77d6842dda005ed2c5795adf8a3ccf4b58/slack_deploy.sh
version="1.0"
function usage {
echo "AWS Elastic Beanstalk Deployment Notifications for Slack (v${version})"
echo
echo "Usage: appsignal_deploy.sh -a <APP NAME> -c <SLACK CHANNEL> -w <WEBHOOK URL> [options]"
echo
echo "Options:"
import json
from botocore.exceptions import ClientError
import boto3
import sys
import logging
logger = logging.getLogger()
logger.setLevel(logging.INFO)
from zabbix.api import ZabbixAPI
@gianrubio
gianrubio / circle.yml
Last active December 17, 2023 22:01
Socks proxy to connect private hosts with circleci
machine:
services:
- docker
post:
- wget https://gist.githubusercontent.com/gianrubio/dce37ee9b9c024937832d776597e2603/raw/4cdb30e5075e8e6064ac48a258e05f518f8c88c0/circleci-tunnel.sh ~/ && chmod +x ~/circleci-tunnel.sh
- ~/circleci-tunnel.sh start:
background: true
echo 127.0.0.1 localhost > /etc/hosts
echo `ifconfig eth0 | awk '/inet addr/{print substr($2,6)}'` `hostname` >> /etc/hosts
FROM alpine:3.3
# Here we install GNU libc (aka glibc) and set C.UTF-8 locale as default.
ENV LC_ALL=en_US.UTF-8 \
LANG=en_US.UTF-8 \
LANGUAGE=en_US.UTF-8
RUN ALPINE_GLIBC_BASE_URL="https://github.com/andyshinn/alpine-pkg-glibc/releases/download" && \
ALPINE_GLIBC_PACKAGE_VERSION="2.23-r1" && \
ALPINE_GLIBC_BASE_PACKAGE_FILENAME="glibc-$ALPINE_GLIBC_PACKAGE_VERSION.apk" && \
import logging
import time
logger = logging.getLogger()
logger.setLevel(logging.INFO)
ch = logging.StreamHandler(sys.stdout)
ch.setFormatter(logging.Formatter("%(levelname)s %(asctime)s %(funcName)s %(lineno)d %(message)s"))
logger.addHandler(ch)
@gianrubio
gianrubio / Increase
Created May 9, 2017 07:21
K8s increase nf_conntrack_max
or i in `kubectl get nodes |grep -v "NAME"| awk '{print $1}'`; do ssh -t core@$i "sudo sysctl net.netfilter.nf_conntrack_max=1000000" ;done
@gianrubio
gianrubio / launch.json
Created July 13, 2017 08:15
debug ingress on vstudio
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch",
"type": "go",
"request": "launch",
"mode": "debug",
"remotePath": "",