Skip to content

Instantly share code, notes, and snippets.

View kamigerami's full-sized avatar
🎯
Focusing

Kami Gerami kamigerami

🎯
Focusing
View GitHub Profile
@kamigerami
kamigerami / get_json_from_firebase_and_email
Created September 24, 2018 09:39
get_json_from_firebase_and_send_email
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import urllib2
import json
import smtplib
import datetime
from smtplib import SMTPException
from email.MIMEText import MIMEText
import string
@kamigerami
kamigerami / idempotent_lineinfile_ansible
Created May 21, 2018 14:49
idempotent DNS rules ansible lineinfile module
- name: Create persistent DNS rules for acepting port 53
lineinfile:
path: /etc/sysconfig/iptables
state: "{{ item.1 }}"
insertbefore: "^-A INPUT (1 - p {{ item.0 }} -- dport 53 -j ACCEPT)?"
line: "-A INPUT 1 -p {{ item.0 }} --dport 53 -j ACCEPT"
with_nested:
- ['TCP', 'UDP']
- ['absent', 'present']

Keybase proof

I hereby claim:

  • I am kamigerami on github.
  • I am kamigerami (https://keybase.io/kamigerami) on keybase.
  • I have a public key ASBLyHnejLedhlD4kM7wfXXH93-gar3Om1euhP_tjDMivgo

To claim this, I am signing this object:

@kamigerami
kamigerami / default.vcl
Last active April 30, 2018 05:55
haproxy + ssl -> varnish -> back to haproxy for loadbalancing to --> backend0/1/2 (webhost)
# This versions uses ELB loadbalancing
# The ELB points to these two HAProxy hosts
# The C-name of the Domain points to the ELB
# ELB -> HAPROXY 1 or 2 -> Varnish --> HIT or MISS --> HAPROXY 1 or 2 -> Backend 1/2/3
vcl 4.0;
import directors;
backend haproxy1 {
.host = "172.31.xx.235"; # back to HAPROXY-1 internal address
.port = "8080";
.probe = {
#!/usr/bin/python
### author : Kami Gerami
### This script will setup a new ghost instance under /var/www/domain/nameofyourblog
### it will create a nginx conf file under /etc/nginx/sites-enabled/nameofyourblog.domain
### it requires template files to be placed under /opt/projects/subtemp.template/{etc,var}
import time
import web
import socket
import shutil
import os
#!/usr/bin/ruby
# CS50 Harvard PSET 1 - Bad Credit in Ruby.
prompt = "Please enter a valid CC number : "
input = nil # initialize the variable so you can invoke methods on it
input_array = Array.new
input_add = Array.new
type_of_card = nil
loop do
puts "#{prompt}"