Skip to content

Instantly share code, notes, and snippets.

View sageworksstudio's full-sized avatar

Chris Brown sageworksstudio

View GitHub Profile
@sageworksstudio
sageworksstudio / Stripe Example
Last active August 29, 2015 14:17 — forked from boucher/gist:1750375
Stripe PHP example
<?php
require('./lib/Stripe.php');
if ($_POST) {
// Set your secret key: remember to change this to your live secret key in production
Stripe::setApiKey("SECRET_KEY");
$error = '';
$success = '';
// Create the charge on Stripe's servers - this will charge the user's card
@sageworksstudio
sageworksstudio / trollRemover.js
Created November 4, 2015 15:32
Troll Remover for Mlive forums.
/**
* Add troll names as a key/value pair:
* 'troll-name':''
* Leave the value blank.
*/
var theTrolls = {'some troll':'','another troll':''},
getDivs = document.getElementsByTagName('div'),
divLength = getDivs.length,
i,
foundOne;
public function getInstagram($count=3) {
$user_id = 'YOUR-USER-ID';
$token = 'YOUR-TOKEN';
$cnt = (int) $count;
$url = "https://api.instagram.com/v1/users/{$user_id}/media/recent/?access_token={$token}&count={$count}";
$curl_connection = curl_init($url);
curl_setopt($curl_connection, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($curl_connection, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl_connection, CURLOPT_SSL_VERIFYPEER, false);
$result = curl_exec($curl_connection);
@sageworksstudio
sageworksstudio / ffmpeg
Created June 8, 2016 20:46
ffmpeg mov to mp4
ffmpeg -i <file.mov> -vcodec copy -acodec aac -strict experimental -ab 128k <file.mp4>
@sageworksstudio
sageworksstudio / php5-on-ubuntu16.md
Last active October 26, 2016 20:59
php5 on Ubuntu 16.04
  1. Add repo ppa

Assuming libapache2-mod-php is a suitable way to enable PHP in Apache for you, you can proceed in this way:

sudo add-apt-repository ppa:ondrej/php

sudo apt-get update

sudo apt-get install php7.0 php5.6 php5.6-mysql php-gettext php5.6-mbstring php-xdebug libapache2-mod-php5.6 libapache2-mod-php7.0

@sageworksstudio
sageworksstudio / copy.sh
Last active September 1, 2017 20:50
Unpack and copy .zip files to disc where /dev/sdX is the path to disc
unzip -p /path/to/file.zip | sudo dd of=/dev/sdX bs=4M conv=fsync status=progress
@sageworksstudio
sageworksstudio / overwrite.sh
Created September 5, 2017 03:45
Overwrite with random data
dd if=/dev/urandom of=/dev/hdX
@sageworksstudio
sageworksstudio / regex.md
Last active February 15, 2018 19:28
Regex cheat sheet

Regex cheat sheet

Search for an alpha-string between two delimiters.

Example: 'images/0-31604-01079-9_label_small.jpg'

In this case we're looking for the string 'label' between the underscore delimiters (not including the delimiters).

This would be our regex /(?<=_)+[A-Za-z]+(?=_)/

  1. Look for the preceeding delimiter, underscore (?<=_)
@sageworksstudio
sageworksstudio / git-help.md
Last active April 11, 2018 16:59
Simple git commands

#Git Help#

##Git Remotes##

VIEW all remotes

git remote -v

ADD remote