Skip to content

Instantly share code, notes, and snippets.

View barooney's full-sized avatar

Daniel Baron barooney

View GitHub Profile
@barooney
barooney / CreateModelsFromGraphCommand.php
Created August 13, 2019 23:19
Create Laravel Models and Migrations from a GraphML file.
<?php /** @noinspection ALL */
namespace App\Console\Commands;
use Fhaculty\Graph\Edge\Directed;
use Fhaculty\Graph\Vertex;
use Graphp\GraphML\Loader;
use Illuminate\Console\Command;
use Illuminate\Support\Carbon;
use Illuminate\Support\Str;
@barooney
barooney / add-subtitles.sh
Last active June 19, 2018 05:49
Add subtitles to video file.
#!/bin/bash
# run with ./add-subtitles.sh video.mp4 subtitles.srt output.mp4
VIDEO_FILE=$1
SUBTITLE_FILE=$2
OUTPUT_FILE=$3
echo "Muxing " $VIDEO_FILE " and " $SUBTITLE_FILE " into " $OUTPUT_FILE "..."
ffmpeg -i $VIDEO_FILE -i $SUBTITLE_FILE -c:a copy -c:v copy -c:s mov_text $OUTPUT_FILE
@barooney
barooney / ghost-import.php
Created April 26, 2018 18:38
Import Ghost exports to WordPress
<?php
define( 'WP_POST_REVISIONS', false );
define( 'BASE_URL', 'YOUR_GHOST_URL' );
include './wp-load.php';
if ( ! function_exists( 'wp_crop_image' ) ) {
include( ABSPATH . 'wp-admin/includes/image.php' );
}
@barooney
barooney / download-with-cep.js
Last active April 13, 2018 04:39
Download a binary file with axios and store it from within a CEP panel using cep.fs
function downloadFile(url, filename) {
axios.get(url, { responseType: 'arraybuffer' }).then(res => {
let data = btoa(new Uint8Array(res.data).reduce((data, byte) => data + String.fromCharCode(byte), ''))
cep.fs.writeFile(filename, data, this.cep.encoding.Base64)
})
}
@barooney
barooney / composer.json
Created January 7, 2016 15:33
FTP to Dropbox Migration
{
"name": "barooney/ftp-dropbox-migrator",
"description": "Migrates a full FTP server to a Dropbox",
"type": "console",
"require": {
"league/flysystem": "^1.0",
"league/flysystem-dropbox": "^1.0"
},
"authors": [
{
@barooney
barooney / AuthController.php
Created September 21, 2015 15:02
Laravel Socialite and Hello.js implementation
use Schoolm8\Http\Requests;
use Illuminate\Support\Facades\Session;
use Schoolm8\Http\Controllers\Controller;
use Laravel\Socialite\Facades\Socialite;
class AuthController extends Controller {
public function proxy( Request $request ) {
if ( ! $request->oauth_token ) {