Skip to content

Instantly share code, notes, and snippets.

Avatar

Ben Yanke benyanke

View GitHub Profile
@benyanke
benyanke / le-renew.sh
Last active Feb 16, 2016 — forked from erikaheidi/le-renew.sh
Auto renewal for Let's Encrypt Apache
View le-renew.sh
#!/bin/bash
#================================================================
# Let's Encrypt renewal script for Apache on Ubuntu/Debian
# @author Erika Heidi<erika@do.co>
# Usage: ./le-renew.sh [base-domain-name]
# More info: http://do.co/1mbVihI
#================================================================
domain=$1
le_path='/opt/letsencrypt'
le_conf='/etc/letsencrypt'
@benyanke
benyanke / wp.sh
Created Jun 23, 2016 — forked from bgallagh3r/wp.sh
Wordpress: Bash Install Script -- Downloads latest WP version, updates wp-config with user supplied DB name, username and password, creates and CHMOD's uploads dir, copies all the files into the root dir you run the script from, then deletes itself!
View wp.sh
#!/bin/bash -e
clear
echo "============================================"
echo "WordPress Install Script"
echo "============================================"
echo "Database Name: "
read -e dbname
echo "Database User: "
read -e dbuser
echo "Database Password: "
@benyanke
benyanke / pocketmine.sh
Created Jun 23, 2016 — forked from greg76/pocketmine.sh
simple shell script to run pocketmine as a service/daemon
View pocketmine.sh
#!/bin/sh
### BEGIN INIT INFO
# Provides: pocketmine
# Required-Start:
# Required-Stop:
# Should-Start:
# Should-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
@benyanke
benyanke / dyndns.sh
Created Jul 3, 2016
update an A record in digital Ocean (digitalocean.com). Dynamic DNS style
View dyndns.sh
#!/bin/bash
#update an A record in digital Ocean. Dynamic DNS style.
#API info here:
#https://developers.digitalocean.com/#domains-list
#your domain ID
domain_id="XXX"
#record to update
record_id="XXX"
#digitalocean client_id
@benyanke
benyanke / ip_in_range.php
Created Jul 11, 2016 — forked from tott/ip_in_range.php
php check if IP is in given network range
View ip_in_range.php
/**
* Check if a given ip is in a network
* @param string $ip IP to check in IPV4 format eg. 127.0.0.1
* @param string $range IP/CIDR netmask eg. 127.0.0.0/24, also 127.0.0.1 is accepted and /32 assumed
* @return boolean true if the ip is in this range / false if not.
*/
function ip_in_range( $ip, $range ) {
if ( strpos( $range, '/' ) == false ) {
$range .= '/32';
}
View My Bashrc File
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
@benyanke
benyanke / BASH: Reminder to 'git pull'
Last active Oct 5, 2016
BASH: Reminder to 'git pull'. This function hooks into CD to remind you to 'git pull' when entering a repository directory. It will only alert you every X seconds.
View BASH: Reminder to 'git pull'
cd() {
# Seconds between alerts: raise this
# number if you want to get fewer alerts
# Default: 10 min
alertDelay=600
# Alert text: this is displayed when you
# CD into a git repo
alertText="\n##################################################\n This is a git repo. Don't forget to 'git pull'\n##################################################\n"
@benyanke
benyanke / setupLbryServer.sh
Created Nov 14, 2016
LBRY Server Setup - Setup script to install LBRY on a headless debian or ubuntu server
View setupLbryServer.sh
#!/bin/bash
#################################
# Written by Ben Yanke
# https://github.com/benyanke
#
# This script sets up the lbry daemon
# for use on a headless server.
#
# Currently tested on Ubuntu Server 16.04.1 LTS
@benyanke
benyanke / README.md
Created Feb 16, 2017 — forked from oodavid/README.md
Deploy your site with git
View README.md

Deploy your site with git

This gist assumes:

  • you have a local git repo
  • with an online remote repository (github / bitbucket etc)
  • and a cloud server (Rackspace cloud / Amazon EC2 etc)
    • your (PHP) scripts are served from /var/www/html/
    • your webpages are executed by apache
    • apache's home directory is /var/www/
@benyanke
benyanke / client.py
Created Mar 16, 2017 — forked from yoavram/client.py
Example of uploading binary files programmatically in python, including both client and server code. Client implemented with the requests library and the server is implemented with the flask library.
View client.py
import requests
#http://docs.python-requests.org/en/latest/user/quickstart/#post-a-multipart-encoded-file
url = "http://localhost:5000/"
fin = open('simple_table.pdf', 'rb')
files = {'file': fin}
try:
r = requests.post(url, files=files)
print r.text
You can’t perform that action at this time.