Skip to content

Instantly share code, notes, and snippets.

@DuGites
DuGites / README.md
Last active August 29, 2015 14:21 — forked from smagch/README.md
aws cloudformation create-stack --stack-name hogehoge --template-body file://conf.json --region ap-northeast-1 --parameters file://param.json
@DuGites
DuGites / djangoeb.js
Created January 24, 2017 17:09 — forked from masayang/djangoeb.js
CloudFormation script for Django/ElasticBeansTalk with Jenkins environment
{
"AWSTemplateFormatVersion" : "2010-09-09",
"Description" : "AWS CloudFormation Template: This template installs a single-instance with dev environment for elastic beanstalk as well as Jenkins server. This template creates an Amazon EC2 instance. You will be billed for the AWS resources used if you create a stack from this template.",
"Parameters" : {
"EC2Tag" : {
"Description" : "EC2 tag name",
"Type" : "String"
},
#!/bin/sh
#Lernu esperanton :-)
wget -nc http://www.oreilly.com/programming/free/files/microservices-for-java-developers.pdf
wget -nc http://www.oreilly.com/programming/free/files/modern-java-ee-design-patterns.pdf
wget -nc http://www.oreilly.com/programming/free/files/object-oriented-vs-functional-programming.pdf
wget -nc http://www.oreilly.com/programming/free/files/java-the-legend.pdf
wget -nc http://www.oreilly.com/programming/free/files/a-whirlwind-tour-of-python.pdf
wget -nc http://www.oreilly.com/programming/free/files/hadoop-with-python.pdf
wget -nc http://www.oreilly.com/programming/free/files/how-to-make-mistakes-in-python.pdf
@DuGites
DuGites / nginx_parser.py
Last active January 26, 2018 00:24
Nginx Log Parser.
from dateutil import parser
import datetime
# Tail from actual nginx access.log
from sys import stdin
lines = [
'93.180.71.3 - - [17/May/2015:08:05:32 +0000] "GET /downloads/product_1 HTTP/1.1" 502 0 "-" "Debian APT-HTTP/1.3 (0.8.16~exp12ubuntu10.21)',
'93.180.71.3 - - [17/May/2015:08:05:23 +0000] "GET /downloads/product_1 HTTP/1.1" 304 0 "-" "Debian APT-HTTP/1.3 (0.8.16~exp12ubuntu10.21)',
'80.91.33.133 - - [17/May/2015:08:05:24 +0000] "GET /downloads/product_1 HTTP/1.1" 502 0 "-" "Debian APT-HTTP/1.3 (0.8.16~exp12ubuntu10.17)',
'217.168.17.5 - - [17/May/2015:08:05:34 +0000] "GET /downloads/product_1 HTTP/1.1" 200 490 "-" "Debian APT-HTTP/1.3 (0.8.10.3)',
@DuGites
DuGites / open_hours.py
Created January 26, 2018 00:29
Open Hours Checker
"""
Edge cases:
1. Empty hours hours = {}
2. Some days not having open/close hours or both {"close":{"day":0,"time":""},"open":{"day":0,"time":""}},
3. Some stores might not have hours.
4. Some stores might have close hours and not open hours.
example:
isOpen('store_1') // open
isOpen('store_2') // closed
@DuGites
DuGites / setup-kubernetes-ubuntu-16.md
Created September 23, 2018 01:48 — forked from ruanbekker/setup-kubernetes-ubuntu-16.md
Install a 3 Node Kubernetes Cluster on Ubuntu 16

Master: Dependencies

apt update && apt upgrade -y
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -

cat <<EOF > /etc/apt/sources.list.d/kubernetes.list
deb http://apt.kubernetes.io/ kubernetes-xenial main
EOF
killall ssh-agent; eval `ssh-agent`
@DuGites
DuGites / _aws_golang_examples.md
Created October 17, 2018 16:28 — forked from eferro/_aws_golang_examples.md
golang aws: examples

AWS Golang SDK examples

@DuGites
DuGites / sshclient.go
Created November 17, 2018 00:24 — forked from josephspurrier/sshclient.go
Golang SSH Client
package main
import (
"bufio"
"io/ioutil"
"os/signal"
//"syscall"
"fmt"
"log"
"os"
@DuGites
DuGites / glog
Created November 17, 2018 00:29 — forked from metrofx/glog
Pretty git log, displays 20 last commits.
#!/bin/sh
git --no-pager log -n 20 --graph --pretty=format:'%Cred%h%Creset %an: %s - %Creset %C(yellow)%d%Creset %Cgreen(%cr)%Creset' --abbrev-commit --date=relative