Skip to content

Instantly share code, notes, and snippets.

View rdundon's full-sized avatar

Robert Dundon rdundon

View GitHub Profile
@rdundon
rdundon / Mac-quicktime-to-mp4-video.sh
Last active April 18, 2025 15:16
Convert MacOS screen recordings in Quicktime to smaller MP4s via CLI
# A quick way to convert MacOS screen recordings in Quicktime to smaller MP4s
ffmpeg -i input.mov -vcodec h264 -crf 28 -acodec aac output.mp4
@rdundon
rdundon / how-to-setup-zscaler-npm-on-mac.md
Last active April 22, 2025 18:44
How to Setup NPM to work with Zscaler on Mac
  1. Get the Zscaler Root CA. You likely need permission from your IT dept, or for them to provide it for you.

  2. Convert the .crt file to a .pem file per this SO answer:

    openssl x509 -in /Users/useraccount/ZscalerRootCA.cer -out /Users/useraccount/ZscalerRootCA.cer
  3. Edit (or create if nonexistent) ~/.npmrc file ([official npmrc docs]):

@rdundon
rdundon / showJSON.js
Last active April 4, 2025 17:51
Show JSON (React Native Version)
// Just shows props as JSON, To be used for testing and as a stub/placeholder
// Like https://gist.github.com/rdundon/6f1c2e5c9cd7d39db950c4d713ca0c6d , but React Native
const ShowJSON = (props) => {
return ( <Text>
{JSON.stringify(props)}
</Text> );
}
// "videoTag" is <video> element pulled from the DOM
var videoPercentageRate = this.duration / 100;
var videoCompletionRateIntervals = [25,50,75,100];
videoTag.play = function() {
var percentageCompleted = (videoTag.currentTime / videoTag.duration) * 100
console.log(percentageCompleted);
if (percentageCompleted >= videoCompletionRateIntervals[0]) {
console.log(videoCompletionRateIntervals[0], '% of video completed');
// "videoTag" is <video> element pulled from the DOM
var videoPercentageRate = this.duration / 100;
var videoCompletionRateIntervals = [25,50,75,100];
videoTag.play = function() {
var percentageCompleted = (videoTag.currentTime / videoTag.duration) * 100
console.log(percentageCompleted);
if (percentageCompleted >= videoCompletionRateIntervals[0]) {
console.log(videoCompletionRateIntervals[0], '% of video completed');
/**
* Little script/function to get time intervals
*/
// Based on:
// https://stackoverflow.com/a/19225446/808870
const diffInHours = (startDate, endDate) => ( endDate.valueOf() - startDate.valueOf() ) / 1000 / 60 / 60;
const getTimeIntervalsPerHour = interval => {
@rdundon
rdundon / ShowJSON.js
Created September 4, 2019 15:25
Show JSON component
// Just shows props as JSON, To be used for testing and as a stub/placeholder
const ShowJSON = (props) => {
return ( <pre>
{JSON.stringify(props)}
</pre> );
}
@rdundon
rdundon / date_update.php
Created December 27, 2017 19:52
Update time without NTP with PHP
<?php
/**
* Little script to update date based on SO answer here: https://askubuntu.com/a/655528/158714
* but with more security in mind (as that answer just feeds the output right into bash)
*
* Useful for little VMs when NTP is blocked and you put VMs into saved state regularly/
*
* Run via cron as root or other privileged user.
*
* Robert Dundon
@rdundon
rdundon / git-setup.sh
Last active April 4, 2025 17:49 — forked from patik/git-setup.sh
Git and Node with Zscaler proxy
#!/bin/sh
# Git proxy settings
echo "Configuring Git for compatibility with ZScaler..."
git config --global http.proxy http://gateway.zscaler.net:80/
git config --system http.proxy http://gateway.zscaler.net:80/