Skip to content

Instantly share code, notes, and snippets.

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

Glenn Batuyong 47ronin

👨‍🚀
🖌
View GitHub Profile
@47ronin
47ronin / gist:09fa72900835dfbf54e0061a3f93e44b
Created June 1, 2023 07:45
Use a Samba share from within Linux or WSL environment
sudo mount -t cifs -o rw,vers=3.0,user=USER,uid=USER //URL/SHARENAME /mnt/MOUNTNAME
cd /mnt/MOUNTNAME/PATH/TO/WHATEVER
[do stuff]
sudo umount /mnt/MOUNTNAME
@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
@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 / yt-dlp.sh
Last active April 7, 2024 06:28
Use yt-dlp to merge best video and best audio formats together into an MPEG-4 container, check for AV1/VP9, and transcode to H.264 if necessary. Usage: ./yt-dlp.sh <video_url>
#!/bin/bash
youtube_url="$1"
echo "Downloading video..."
video_info=$(yt-dlp -e -o "%(title)s" -- "$youtube_url")
sanitized_title=$(echo "$video_info" | sed 's/[^a-zA-Z0-9_.-]/_/g')
output_file="${sanitized_title}.mp4"
yt-dlp -o "temp.mp4" -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best' -- "$youtube_url"
@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 / 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 / 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 / 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 / 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 / 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),