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 / wpa_supplicant.md
Last active May 25, 2020 19:41
Headless Raspberry Pi - Add this file to the boot partition.

wpa_supplicant.conf

country=US
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
    ssid="your_real_wifi_ssid"
 scan_ssid=1
@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 / Headless Raspberry Pi and PiCam setup.md
Last active May 25, 2020 19:28
Raspberry Pi and PiCam setup (headless)

Headless Raspberry Pi

Note: This assumes you've already flashed an SD card. In this gist I used Jesse Stretch Lite.

  1. After flashing the sd card, create and add a blank file named "ssh" to the /boot partition. This will turn on ssh when the Pi boots. Also create and add a file called "wpa_supplicant.conf" to the /boot partition as well. Configure the contents of the wpa_supplicant.conf file like this: {See This Gist}

  2. Insert your sd card into the Pi and boot the Pi. From a remote machine find your Pi's IP address using a tool like Fing.

  3. After logging in, run these commands:

@sageworksstudio
sageworksstudio / lightdm.md
Last active May 25, 2020 19:30
Prevent Debian from sleeping

Prevent Debian From Sleeping

$ nano /etc/lightdm/lightdm.conf

Add:

xserver-command=X -s 0 -dpms