Skip to content

Instantly share code, notes, and snippets.

View 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 Jan 24, 2017 — forked from masayang/djangoeb.js
CloudFormation script for Django/ElasticBeansTalk with Jenkins environment
View djangoeb.js
{
"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"
},
View script-books.sh
#!/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 Jan 26, 2018
Nginx Log Parser.
View nginx_parser.py
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 Jan 26, 2018
Open Hours Checker
View open_hours.py
"""
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 Sep 23, 2018 — forked from ruanbekker/setup-kubernetes-ubuntu-16.md
Install a 3 Node Kubernetes Cluster on Ubuntu 16
View setup-kubernetes-ubuntu-16.md

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
@DuGites
DuGites / sshclient.go
Created Nov 17, 2018 — forked from josephspurrier/sshclient.go
Golang SSH Client
View sshclient.go
package main
import (
"bufio"
"io/ioutil"
"os/signal"
//"syscall"
"fmt"
"log"
"os"
@DuGites
DuGites / glog
Created Nov 17, 2018 — forked from metrofx/glog
Pretty git log, displays 20 last commits.
View glog
#!/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