Skip to content

Instantly share code, notes, and snippets.

View franchb's full-sized avatar
🎯
Focusing

Eliah Rusin franchb

🎯
Focusing
View GitHub Profile
@franchb
franchb / gist:10ff9a0c3557925b345d9a2047f04ab8
Created March 31, 2016 15:56 — forked from ericandrewlewis/gist:95239573dc97c0e86714
Setting up a WordPress site on AWS

Setting up a WordPress site on AWS

This tutorial walks through setting up AWS infrastructure for WordPress, starting at creating an AWS account. We'll manually provision a single EC2 instance (i.e an AWS virtual machine) to run WordPress using Nginx, PHP-FPM, and MySQL.

This tutorial assumes you're relatively comfortable on the command line and editing system configuration files. It is intended for folks who want a high-level of control and understanding of their infrastructure. It will take about half an hour if you don't Google away at some point.

If you experience any difficulties or have any feedback, leave a comment. 🐬

Coming soon: I'll write another tutorial on a high availability setup for WordPress on AWS, including load-balancing multiple application servers in an auto-scaling group and utilizing RDS.

#!/bin/bash -xv
# Initialize Amazon Linux AMI 2015.09 for PHP7 Web Application
# yum
# update default
sudo yum upgrade --enablerepo="*" -y
# install php
for i in $(seq 3)
do
[ ! -s remi-release-6.rpm ] && curl --connect-timeout 3 http://remi.kazukioishi.net/enterprise/remi-release-6.rpm > remi-release-6.rpm
@franchb
franchb / autovpn.py
Created June 20, 2016 15:52 — forked from domenkozar/autovpn.py
AutoVPN for NetworkManager
#!/usr/bin/env python
"""
Copyright 2011 Domen Kozar. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are
permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of
conditions and the following disclaimer.

Keybase proof

I hereby claim:

  • I am franchb on github.
  • I am franchb (https://keybase.io/franchb) on keybase.
  • I have a public key ASB7OiTK56kp9k0wpADInKwiqAYi638MWZI-eJ31bNfrWgo

To claim this, I am signing this object:

@franchb
franchb / protocol.md
Last active October 6, 2016 08:21
Анализ размера частицы в процессе анализа почвы

Авторы: L. P. van Reeuwijk (ISRIC), перевод и адаптация Русин И. В. (franchb@protonmail.ch)

Abstract

Разделение минеральной части почвы на фракции различного размера и определение пропорции этих фракций. Анализ включает все материалы, включая гравий и грубые материалы, но процедуры в указанном протоколе могут быть приложены лишь к чистой земле (<2 мм).

Первостепенное значение в этом анализе - это предварительная обработка образца, направленная на полное разделение первичных частиц. Поэтому, связывающие материалы (обычно, вторичного происхождения), такие как неорганическое вещество и карбонат кальция, могут быть удалены. В некоторых случаях полуторные оксиды также необходимо удалять. Хотя, могут быть аргументы, что для сельскохозяйственных целей часто бывает нерелевантным или даже фундаментально-ошибочным удаление данных компонентов.

@franchb
franchb / discrete_cmap.py
Created July 15, 2017 06:10 — forked from jakevdp/discrete_cmap.py
Small utility to create a discrete matplotlib colormap
# By Jake VanderPlas
# License: BSD-style
import matplotlib.pyplot as plt
import numpy as np
def discrete_cmap(N, base_cmap=None):
"""Create an N-bin discrete colormap from the specified input map"""
@franchb
franchb / gist:7944ad034171cce934e3da5ee9e10b74
Created November 9, 2017 20:13
Franchb Blockstack ID verification
Verifying my Blockstack ID is secured with the address 1MeCc7ajem6iSuiDGFMLgh9kQYp8okC5w4 https://explorer.blockstack.org/address/1MeCc7ajem6iSuiDGFMLgh9kQYp8okC5w4
@franchb
franchb / aws-lambda-static-type-checker.md
Created January 6, 2018 18:02 — forked from alexcasalboni/aws-lambda-static-type-checker.md
AWS Lambda Static Type Checker Example (Python3)

How to use Python3 Type Hints in AWS Lambda

TL;DR

Static Type Checkers help you find simple (but subtle) bugs in your Python code. Check out lambda_types.py and incrementally improve your code base and development/debugging experience with type hints.

Your Lambda Function code will go from this:

@franchb
franchb / replace_crlf.sql
Created January 29, 2018 09:24
SQL CRLF / endline issue
REPLACE(REPLACE(REPLACE(mycolumn, CHAR(9), ''), CHAR(10), ''), CHAR(13), '') as 'mycolumn'
@franchb
franchb / useful_pandas_snippets.py
Created February 2, 2018 05:49 — forked from bsweger/useful_pandas_snippets.md
Useful Pandas Snippets
# List unique values in a DataFrame column
# h/t @makmanalp for the updated syntax!
df['Column Name'].unique()
# Convert Series datatype to numeric (will error if column has non-numeric values)
# h/t @makmanalp
pd.to_numeric(df['Column Name'])
# Convert Series datatype to numeric, changing non-numeric values to NaN
# h/t @makmanalp for the updated syntax!