Skip to content

Instantly share code, notes, and snippets.

View 47ronin's full-sized avatar
👨‍🚀
🖌

Glenn Batuyong 47ronin

👨‍🚀
🖌
View GitHub Profile
@47ronin
47ronin / SocialProfilesSchemaJSON.js
Last active October 23, 2015 16:17
JSON Structured Data Schema for Port of San Diego Social Profiles (Google). See https://developers.google.com/structured-data/customize/social-profiles
<script type="application/ld+json">
{
"@context":"http://schema.org",
"@type":"Organization",
"name":"Port of San Diego",
"url":"https://www.portofsandiego.org",
"logo":"https://www.portofsandiego.org/templates/yoo_sync/styles/SDUPD/images/logo-sdupd.png",
"contactPoint":[
{
"@type":"ContactPoint",
@47ronin
47ronin / angularJS1x_promise_main.js
Last active July 18, 2016 15:58
AngularJS 1.x gather data from promise and do amazing shit
'use strict';
angular.module('someApp')
.controller('MainCtrl',
['$scope', '$http', '$moment', '$q',
function ($scope, $http, $moment, $q) {
var bunchOfShit = 'value',
moreShit = 'anotherValue',
shitURL = 'https://someurl/' + bunchOfShit + '?callback=JSON_CALLBACK',
shitStormURL = 'https://anotherwebsite/' + moreShit + '?callback=JSON_CALLBACK',
dataShit = $http.jsonp(shitURL),
@47ronin
47ronin / download_website.sh
Created July 18, 2016 16:04
Simple command to download a static copy of a website
#!/bin/bash
# Be sure to remove all metric gathering scripts like Google Analytics
wget --mirror --convert-links --adjust-extension --page-requisites --no-parent https://someURL
@47ronin
47ronin / bash_find_filenames.sh
Last active July 18, 2016 16:05
BASH command to recursively search current directory for filenames containing string; case-insensitive, ending with specific extension
#!/bin/bash
find . -iname "*string*.jpg"
@47ronin
47ronin / removeMACOSXdotfiles.sh
Created November 21, 2016 18:23
Simple removal of macOS dotfiles from a path, usually external volumes
find /path/to -name "._*" -o -name ".DS_Store" | sed 's/.*/"&"/' | xargs rm -v
@47ronin
47ronin / ISO8601_RenameJPGs.sh
Last active September 5, 2017 21:40
Rename all JPG files in a path using IPTC/EXIF capture date in ISO 8601 format, plus capture time as a unique serial ID
jhead -n%Y%m%d-%H%M%S *.jpg
@47ronin
47ronin / audiovideo_offset.sh
Created October 1, 2017 23:31
Offsets video track by a specific duration to properly sync with embedded audio, creates a remuxed output file
#!/bin/bash
ffmpeg -i ScrewedUpVideo.mp4 -itsoffset 0.33 -i ScrewedUpVideo.mp4 -vcodec copy -acodec copy -map 0:1 -map 1:0 FixedVideo.mp4
@47ronin
47ronin / combineMP4videos.sh
Created November 8, 2017 17:52
Concatenate similar MP4 videos together into one, long video
#!/bin/bash
ffmpeg -f concat -safe 0 -i <(for f in ./*.mp4; do echo "file '$PWD/$f'"; done) -c copy output.mp4
@47ronin
47ronin / angular_retrieve_json.js
Created January 4, 2023 04:45
OpenAI: Write an angular javascript function that retrieves a JSON response from an HTTPS API and stores the values in an array
function retrieveJSONResponse() {
// create a new HttpClient
const http = new HttpClient();
// retrieve the JSON response from the API
http.get('https://example.com/api/data')
.then(response => {
// store the values in an array
let jsonData = response.data;
let dataArray = [];
@47ronin
47ronin / fixhevc.sh
Last active May 29, 2023 00:05
Batch fix HEVC MP4 screen captures from OBS so they are usable on macOS (QuickTime and Final Cut Pro). Preserves modification date.
#!/bin/bash
for i in *.mp4
do \
ffmpeg -i "$i" -map_metadata 0 -c:v copy -c:a copy -tag:v hvc1 "$HOME/PATH/${i%.*}.mp4"
touch -r "$i" "$HOME/PATH/${i%.*}.mp4"
done