Skip to content

Instantly share code, notes, and snippets.

View remoharsono's full-sized avatar

Remo Harsono remoharsono

View GitHub Profile
@remoharsono
remoharsono / example_image_utils.py
Created March 16, 2019 12:50 — forked from turicas/example_image_utils.py
Layer on top of Python Imaging Library (PIL) to write text in images easily
#!/usr/bin/env python
# coding: utf-8
# You need PIL <http://www.pythonware.com/products/pil/> to run this script
# Download unifont.ttf from <http://unifoundry.com/unifont.html> (or use
# any TTF you have)
# Copyright 2011 Álvaro Justen [alvarojusten at gmail dot com]
# License: GPL <http://www.gnu.org/copyleft/gpl.html>
from image_utils import ImageText
@remoharsono
remoharsono / install-vsftpd-ubuntu.txt
Last active March 4, 2019 08:21
Install VSFTPd on Ubuntu
# My steps in installing vsftpd, modify to suit your need
sudo openssl req -x509 -nodes -newkey rsa:2048 -keyout /etc/ssl/private/vsftpdserverkey.pem -out /etc/ssl/certs/vsftpdcertificate.pem -days 365
sudo apt install vsftpd
sudo cp /etc/vsftpd.conf /etc/vsftpd.conf.original
sudo nano /etc/vsftpd.conf
--------------
anonymous_enable=NO
@remoharsono
remoharsono / .md
Created March 3, 2019 05:31 — forked from blagoeres/.md
⭐ Frontend tooling & development environment for OS X

Setup your development environment for OS X

I bought new Macbook Pro 15 Retina. These are tools I like to install on macOS operating system.

Checklist

Prep OS X

  • Download and install latest version of Xcode from the Mac App Store.
  • Download and install Apple's Command Line Tools by issuing this command xcode-select --install
@remoharsono
remoharsono / Enable HTTP2 (h2) in NGINX.md
Created March 3, 2019 05:30 — forked from blagoeres/Enable HTTP2 (h2) in NGINX.md
🌟 Hypertext Transfer Protocol Version 2 (HTTP/2) in NGINX ⭐
@remoharsono
remoharsono / twitter_follower_list.py
Created February 12, 2019 15:06
List your twitter followers
import requests
from bs4 import BeautifulSoup
headers = {
'User-Agent': 'Mozilla/5.0 (Linux; Android 4.0.4; Galaxy Nexus Build/IMM76B) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.133 Mobile Safari/535.19',
}
def get_next(url, start_number, num_pages, page_number):
response = requests.get(url, headers=headers)
@remoharsono
remoharsono / request.php
Created February 10, 2019 03:00
PHP cURL - Set User Agent as Google Bot
<?php
// taken from: https://github.com/izniburak/google-bot-curl/blob/master/google-bot.php
function googleBot($url)
{
$header = array();
$header[] = 'Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5';
$header[] = 'Cache-Control: max-age=0';
$header[] = 'Content-Type: text/html; charset=utf-8';
$header[] = 'Transfer-Encoding: chunked';
@remoharsono
remoharsono / 0-startup-overview.md
Created February 7, 2019 04:25 — forked from dideler/0-startup-overview.md
Startup Engineering notes
@remoharsono
remoharsono / sendmail.go
Created December 28, 2018 04:59
Send email using via Mailgun API using Go
package main
import (
"fmt"
"log"
mailgun "github.com/mailgun/mailgun-go"
)
var mailgunDomain = "yourdomain.com"
@remoharsono
remoharsono / django-ajax-setup.js
Last active December 24, 2018 09:35
Django - setup ajax csrf header
$(document).ready(function(){
var CSRFToken = $('input[name=csrfmiddlewaretoken]').val();
$.ajaxSetup({
beforeSend: function(xhr) {
xhr.setRequestHeader("X-CSRFToken", CSRFToken);
}
});
});
@remoharsono
remoharsono / klein-url-rewriting.md
Last active December 21, 2018 07:01 — forked from jamesvl/gist:910325
Web server rewrite rules for using klein PHP router

URL-rewriting for klein PHP router

Why rewrite URLs? Check Wikipedia

Apache

Make sure AllowOverride is on for your directory, or put in httpd.conf

# Apache (.htaccess or httpd.conf)

RewriteEngine On