Skip to content

Instantly share code, notes, and snippets.

@daz
daz / RightClick.applescript
Created August 23, 2020 06:47 — forked from vitorgalvao/Right Click.applescript
Make right-clicking on OSX accessible via a keyboard shortcut.
(*
Even though a [native solution][1] exists, it still suffers from a big flaw: it right-clicks the place you cursor is, not what you’re selecting. This addresses that limitation.
You can install this as a [Finder Service, and later asign it a keyboard shortcut][2].
[1]: http://stackoverflow.com/questions/9171613/right-click-shortcut-for-mac-lion-os
[2]: http://www.macosxautomation.com/services/learn/tut01/index.html
*)
@daz
daz / gulpfile.js
Last active February 7, 2022 22:52
Gulpfile to minify single HTML, CSS, JS file, make it a C++ string, and inject it into a C++ file. Handy for Arduino/ESP projects
const gulp = require("gulp");
const gutil = require("gulp-util");
const inject = require("gulp-inject");
const htmlMin = require("gulp-htmlmin");
const cssMinifyOptions = true;
const jsMinifyOptions = {
mangle: {
toplevel: true
},
@daz
daz / reduce_faces.py
Created October 31, 2019 13:17 — forked from tylerlindell/reduce_faces.py
script for reducing faces programmatically with Meshlab's api
#!/usr/bin/env python
import sys
import os
import subprocess
# Script taken from doing the needed operation
# (Filters > Remeshing, Simplification and Reconstruction >
# Quadric Edge Collapse Decimation, with parameters:
# 0.9 percentage reduction (10%), 0.3 Quality threshold (70%)
@daz
daz / QuestCast
Created July 1, 2019 06:50
Cast Oculus Quest to Mac over wifi
#!/bin/sh
echo
echo "Connect Quest and hit <return> to continue..."
read Z
echo
QUEST_IP=`adb shell ip route | grep 'proto kernel' | awk '{print \$9}'`
adb tcpip 5555
@daz
daz / gist:aa6fcb5b048af885be90a2143f9d7630
Created June 2, 2019 06:58
Working M600 firmware May 2019
Matrice 600 Pro:
Fw DJI M600P - v.1.00.01.67 (2019.02)
Fw DJI LighBridge (Air System) - 1.1.60
Remote Controller:
DJI GO app - 3.1.50
Fw Lightbridge2 - 1.1.60
Remote Controller - 1.2.10
@daz
daz / clean_usb.sh
Created April 26, 2019 07:44
Clean macOS dotfiles from a USB
# Remove invisible dotfiles from a directory or USB drive
# Usage:
# cd /Volumes/MY_USB
# clean_usb.sh
dot_clean $(pwd)
rm -rf .fseventsd
rm -rf .TemporaryItems
@daz
daz / liblas.rb
Created April 26, 2019 04:54
LibLas with LasZip homebrew
class Liblas < Formula
desc "C/C++ library for reading and writing the LAS LiDAR format"
homepage "https://liblas.org/"
url "https://download.osgeo.org/liblas/libLAS-1.8.1.tar.bz2"
sha256 "9adb4a98c63b461ed2bc82e214ae522cbd809cff578f28511122efe6c7ea4e76"
revision 1
head "https://github.com/libLAS/libLAS.git"
bottle do
rebuild 1
@daz
daz / google-earth-studio-ffmpeg.sh
Created January 23, 2019 06:35
Google Earth Studio stitch image sequence with FFmpeg
ffmpeg -framerate 30 -pattern_type glob -i '*.jpeg' -c:v libx264 -pix_fmt yuv420p output.mp4
uint8_t breathBrightness = (exp(sin(millis() / (float)breathRate * PI)) - 0.36787944) * 108.0;
uint8_t brightness = constrain(map(breathBrightness, 0, 250, 80, 255), 0, 255);
leds[0] = CHSV(hue, 255, brightness);
require 'pwned'
PI = '3.14159265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211706798214808651328230664709384460955058223172535940812848111'
for n in 1..40
password = Pwned::Password.new PI[0..(n + 1)]
str = [ n.to_s.rjust(2) ]
str << (password.pwned? ? '😡' : '😃')
str << password.pwned_count.to_s.rjust(4)
str << password.password