Skip to content

Instantly share code, notes, and snippets.

@greg-randall
greg-randall / gist:968129530d1078ce62f9e2bdfcb1be36
Created October 17, 2021 15:23
Samsung Gear 360 2017 Image Bracketing.
#notes:
#follow the instructions on https://github.com/ottokiksmaler/gear360_modding to get to the point of opening the Gear 360's web server -- http://192.168.43.1:8888
#the below series of commands when pasted & executed in the "Execute a command" box will produce 14 bracketed exposures.
#14 exposures is probably overkill. I think probably 5 would work fine. (Maybe 1/8th - 1/2000th)
#The first section sets several variables. For the full list see https://github.com/ottokiksmaler/nx500_nx1_modding/blob/master/ST_CAP_CAPDTM.md
#30 = USERDATA_ISONR -- turn off ISO noise removal
#31 = USERDATA_LTNR -- turn off long exposure noise removal
#5 = USERDATA_ISO -- set ISO to 100
Combine, Crop, and Remove similar frames
find *.mkv | sed 's:\ :\\\ :g'| sed 's/^/file /' > fl.txt; ffmpeg -f concat -i fl.txt -filter:v "crop=704:452:0:28",mpdecimate=hi=1536:lo=640:frac=0.5,setpts=N/FRAME_RATE/TB -qscale:v 2 ../output.mp4
Adjust speed to your liking
ffmpeg -i input.mp4 -r 30 -filter:v "setpts=0.01*PTS" -q:v 10 ouput.mp4
@greg-randall
greg-randall / pixel.php
Last active August 26, 2021 13:39
Super simple tracking pixel. Upload to your server. Add an image to your page like <img alt="" src="pixel.php?e=jim.smith@example.com&fn=jim&ln=smith&c=campaign">
<?php
/* add to an email or on a website like this:
<img alt="" width="1" height="1" src="pixel.php?e=jim.smith@qwerty.com&fn=jim&ln=smith&c=testing">
the information will be logged.
this approach has some limitations, so if you expect heavy volumes you might try something else.
*/
@greg-randall
greg-randall / gist:b339995a6ba3c4cf8e04ddb392cb8499
Last active June 13, 2024 16:37
Generate QR Code for URL
# --background=00000000 makes a transparent background, to make it easier for placement in other materials
qrencode -s 60 -l H --background=00000000 -o "output.png" "https://www.asdf.com/querty"
pngcrush output.png output_c.png
@greg-randall
greg-randall / index.php
Last active July 23, 2021 15:33
Title Case converter for WordPress post exports.
<?php
/*
Takes a Wordpress Post export and changes the case of the words in the <title> tag to title-case.
This will print out a list of titles at the top with the title case and then the original case, so
you can check over and make sure that you don't need to add any special cases:
Add acronyms or words with non-standard capitalization to the array $caps_words. (note, add spaces
around the word/phrase i.e. ' GitHub '.
To update existing posts requires a temporary addition to your functions file --
@greg-randall
greg-randall / index.php
Last active July 1, 2025 14:23
HTML Cleaner. Paste dirty html into a field, and it removes nearly all HTML attributes (except the ones you want -- src, href, alt, and a couple others), and formats. Using proper DOMDocument PHP parser.
<?php
/*
Note that the cleaner sends the html to DirtyMarkup for formatting.
Example input:
<div class=WordSection1>
<p class=MsoNormal align=center style='text-align:center'><span
style='font-size:16.0pt;line-height:107%;font-family:"Abadi Extra Light",sans-serif'>Test
Clean<o:p></o:p></span></p>
@greg-randall
greg-randall / compress.sh
Last active September 29, 2021 16:59
Compresses a JPEG both lossy and lossless and then strips the metadata. Uses MozJpeg, JpegTran, ExifTool, and Genius to compress and report some data.
#!/bin/bash
#to compress a folder:
#for i in *;do ./compress.sh "$i";done
new_file_name=$(sed 's/ /_/g' <<< "${1%.*}_c.jpg")
cjpeg "$1" | jpegtran -o | exiftool - -all= > "$new_file_name"
before_size=$(wc -c "$1" | awk '{print $1}')
@greg-randall
greg-randall / face_mv.py
Last active March 22, 2021 20:54
Quick and dirty way to sort photos into ones that contain a face or don't contain a face using Imagga.
import os
import re
def get_face(img_name):
#find your imagga curl user info on your account
#saves face data as a json
command = f"curl -s --user \"_________imagga-user-code__________\" -F \"image=@{img_name}\" \"https://api.imagga.com/v2/faces/detections\" > {img_name}.json"
os.system(command)
@greg-randall
greg-randall / pano2vr_spin_generator.php
Created March 19, 2021 19:34
For generating spinning videos from spherical panoramic images using pano2vr. Sample: https://www.youtube.com/watch?v=l_VrEJUUh64
<pre><?php
/*
For generating spinning videos from spherical panos using pano2vr:
https://www.youtube.com/watch?v=l_VrEJUUh64
Fill out the config below.
Run the code, copy and paste the output into a file named "spin.p2vr" or similar.
Make sure your input image is in the same location as your spin.p2vr file.
Open the spin.p2vr file and then hit 'create all' at the bottom right.
@greg-randall
greg-randall / gist:00cc2fb7e1650499e2be20ede5db1b67
Created October 13, 2020 13:52
Strip strip audio from a whole folder of video. Very useful for b-roll shoots.
mkdir no-audio; for f in *.MP4; do ffmpeg -i "$f" -an -c:v copy no-audio/$f; done