Skip to content

Instantly share code, notes, and snippets.

View benallfree's full-sized avatar

Ben Allfree benallfree

  • Reno, NV
View GitHub Profile
<?php echo 'whoim = '.exec('/usr/bin/whoami');
#!/usr/bin/perl
my $id = (getpwuid($<))[0];
print "Content-type: text/html\n\n";
print "<html><body>";
print qq($id\n);
print "</body></html>";
@benallfree
benallfree / gitpromot.sh
Created August 10, 2014 17:56
gitprompt config
GIT_PROMPT_ONLY_IN_REPO=0
source /etc/skel/.bash-git-prompt/gitprompt.sh
alias ls='ls -lah'
shopt -s dotglob
@benallfree
benallfree / webhook.md
Created August 4, 2014 02:42
How to make a github webhook

How to make a github web hook

  1. Copy github.php to your web root. Change the password as needed.
  2. Copy update.sh and change paths as needed.
  3. Go to the github repo's settings and find the Webhook & Services section
  4. Input the URL to github.php, making sure to match the password you chose.
@benallfree
benallfree / update.sh
Created August 4, 2014 02:33
Update script for Laravel+Composer
#!/bin/bash
export HOME=/home/samplesale
git pull origin master
/usr/local/bin/composer install
php artisan migrate -n
chmod -R 755 .
chmod -R 775 app/storage
@benallfree
benallfree / github.php
Last active August 29, 2015 14:04
github PHP webhook responder
<?php
if(!$_GET['pw']=='hFGw6DSxIFo8n7c4mb0RRCAdxAsK1jTDyZPyb6xlxqXKq6tM2') die('ok');
$data = json_decode($HTTP_RAW_POST_DATA,true);
chdir(dirname(__DIR__));
exec('bash update.sh', $output, $return);
die(join("\n",$output));
@benallfree
benallfree / setup.sh
Last active August 15, 2018 01:03
Ubuntu LAMP++ (Ubuntu 18.04.1 LTS / Apache / PHP 7.2 / Beanstalk / Certbot / git / composer / git-lfs)
#!/bin/bash
SSHPK="..."
MYSQLP="..."
MYSQLDB="..."
USERP="..."
ufw allow http
ufw allow https
ufw allow mysql
ufw allow ssh
echo y | ufw enable
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /home/user/public_html
ErrorLog /home/user/public_html/error.log
CustomLog /home/user/public_html/access.log combined
<Directory /home/user/public_html>
Options Indexes FollowSymLinks
AllowOverride All
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
@benallfree
benallfree / Wistia API
Created May 13, 2014 23:01
Wistia Upload and Status Demo
class WistiaApi
{
static $WISTIA_UPLOAD_URL='https://upload.wistia.com';
static $WISTIA_API_URL='https://api.wistia.com/v1';
function __construct($api_key)
{
$this->key = $api_key;
}