Skip to content

Instantly share code, notes, and snippets.

View bateller's full-sized avatar
🎯
Focusing

Brian A. Teller bateller

🎯
Focusing
View GitHub Profile
#!/bin/sh
# Based on instructions found here: http://wiki.razuna.com/display/ecp/FFMpeg+Installation+on+CentOS+and+RedHat#FFMpegInstallationonCentOSandRedHat-InstallX264
if [ "`/usr/bin/whoami`" != "root" ]; then
echo "You need to execute this script as root."
exit 1
fi
cat > /etc/yum.repos.d/centos.repo<<EOF
# Install linux update, followed by GCC and Make
sudo yum -y update
sudo yum install -y gcc make
# Install Nginx and PHP-FPM
sudo yum install -y nginx php-fpm
# Install PHP extensions
sudo yum install -y php-devel php-mysql php-pdo \
php-pear php-mbstring php-cli php-odbc \
@bateller
bateller / gist:154c6e5d1f6e0e53e527
Last active July 1, 2020 23:11 — forked from boucher/gist:1750375
Stripe Example (Works with v2 of Stripe-PHP)
<?php
// Edited boucher/gist:1750375 to work with stripe-php v2
require 'stripe-php/init.php';
if ($_POST) {
\Stripe\Stripe::setApiKey("YOUR-API-KEY");
$error = '';
$success = '';
try {
if (!isset($_POST['stripeToken']))
throw new Exception("The Stripe Token was not generated correctly");
@bateller
bateller / New osTicket nginx settings...
Last active August 29, 2015 14:23
New/Old osTicket nginx settings
# Requests to /users/tickets/api/* need their PATH_INFO set, this does that
if ($request_uri ~ "^/users/tickets/api(/[^\?]+)") {
set $path_info $1;
}
# /api/*.* should be handled by /api/http.php if the requested file does not exist
location ~ ^/users/tickets/api/(tickets|tasks)(.*)$ {
try_files $uri $uri/ /users/tickets/api/http.php;
}
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://www.dan.me.uk/tornodes');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (X11; Linux i586; rv:31.0) Gecko/20100101 Firefox/31.0');
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$html = curl_exec($ch);
@bateller
bateller / index.html
Created January 12, 2016 12:20 — forked from 1forh/index.html
Prevent map zoom on scroll
<div id="map_wrapper">
<iframe id="map_canvas"></iframe>
</div>
@bateller
bateller / crontab
Created May 11, 2016 14:09 — forked from tovbinm/crontab
Logrotate & upload nginx logfiles to s3://bucket/dt=..../hostname.log...gz
# Nginx - logrotate & upload to S3
0 0 * * * /usr/sbin/logrotate /etc/logrotate.d/nginx
15 0 * * * s3cmd put /var/log/nginx/access.log-`date +"\%Y\%m\%d"`.gz s3://$LOGS_BUCKET_NAME/nginx-access/`date +"dt=\%Y\%m\%d"`/`hostname -s`.access.log-`date +"\%Y\%m\%d"`.gz
@bateller
bateller / sms-for-free.md
Created July 28, 2016 21:18 — forked from coolaj86/sms-for-free.md
Send text messages for free via email via xminder cell phone carrier lookup
@bateller
bateller / transform-html5.php
Created August 12, 2016 13:13 — forked from bzerangue/transform-html5.php
PHP: XSLT Transformation to build HTML5 html output (use xhtml 1.0 strict as your settings in your XSLT stylesheet)
<?php
// Load the XML source
$xml = new DOMDocument;
$xml->load('XML_SOURCE_LINK_HERE');
// Load XSLT stylesheet
$xsl = new DOMDocument;
$xsl->load('XSL_STYLESHEET_PAGE_LINK_HERE');
@bateller
bateller / README.md
Created April 15, 2017 01:33 — forked from oodavid/README.md
Deploy your site with git

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/