Skip to content

Instantly share code, notes, and snippets.

View jamiehs's full-sized avatar

Jamie Hamel‑Smith jamiehs

View GitHub Profile
@jamiehs
jamiehs / find.sh
Created August 8, 2019 20:47
Find mtime quirks
find . -mtime +0 # find files modified greater than 24 hours ago
find . -mtime 0 # find files modified between now and 1 day ago
# (i.e., in the past 24 hours only)
find . -mtime -1 # find files modified less than 1 day ago (SAME AS -mtime 0)
find . -mtime 1 # find files modified between 24 and 48 hours ago
find . -mtime +1 # find files modified more than 48 hours ago
@jamiehs
jamiehs / dactyl.clj
Created July 14, 2019 20:40
Dactyl Manuform with 5x6/5x7 and aviator connections
(ns dactyl-keyboard.dactyl
(:refer-clojure :exclude [use import])
(:require [clojure.core.matrix :refer [array matrix mmul]]
[scad-clj.scad :refer :all]
[scad-clj.model :refer :all]
[unicode-math.core :refer :all]))
(defn deg2rad [degrees]
(* (/ degrees 180) pi))
@jamiehs
jamiehs / rename-prefix.sh
Created July 12, 2019 18:48
Finds files in the current directory based on a file name pattern and then executes a move command while finding and replacing a component of the file name.
# remove echo to execute the actual mv command
find . -type f -name "prefix-*.json" -exec bash -c 'echo mv "$1" "${1/find/replace}"' -- {} \;
@jamiehs
jamiehs / proto-pasta-ppu-htpla.ini
Created June 29, 2019 23:53
Proto-Pasta Powder Puff Unicorn Settings for PrusaSlicer
# generated by PrusaSlicer 2.0.0 on 2019-06-29 at 16:47:15
[filament:Proto-Pasta PPU jamiehs]
filament_colour = #5EDBE8
filament_max_volumetric_speed = 4
filament_type = PLA
first_layer_bed_temperature = 60
first_layer_temperature = 230
inherits = Generic PLA
max_fan_speed = 80
@jamiehs
jamiehs / package.json
Created September 14, 2018 21:04
When Node is installing dependancies, there is a variable we can use to conditionally run something in production/!production
{
"scripts": {
"postinstall": "if [ -n \"$npm_config_production\" ]; then npm run build; fi"
}
}
@jamiehs
jamiehs / in_this_language.md
Last active April 21, 2017 15:45
In This Language (add your comments or suggestions)

Input

foo bar baz qux

Required Output

Hello Foo
Hello Bar
Hello Baz
Hello Qux
@jamiehs
jamiehs / .my.cnf
Created December 8, 2016 22:20
Place this file in your home directory (OS X) and you will not need to specify a MySQL password for your local client.
[client]
user='root'
password='123'
{
// The default number of parapraphs to be inserted
"default_paragraph_count": 1,
// The default number of words for each parapraph to be inserted
"default_word_count": 7,
// If true, the generated text will always starts with "Lorem ipsum"
"always_start_with_lorem_ipsum": false,
@jamiehs
jamiehs / absolute-element-height.js
Last active November 10, 2015 00:43
A novel method of finding the height of an absolutely positioned element. From: http://stackoverflow.com/a/20791125
function absElemHeight(element){
var max_y = 0;
$.each( $(element).find('*'), function(idx, desc){
max_y = Math.max(max_y, $(desc).offset().top + $(desc).height());
});
return max_y - $(element).offset().top;
}
function absElemHeight(element){
@jamiehs
jamiehs / functions.php
Created October 8, 2015 05:00
Force https for the scheme-relative URLs in Fluid Video Embeds (requires 1.2.9 or higher)
<?php // only keep the opening PHP tag if your functions.php doesn't have one.
// Filter the iframe URL for Vimeo
add_filter( 'fve_vimeo_iframe_url', 'fve_vimeo_iframe_url', 10, 2 );
function fve_vimeo_iframe_url( $vimeo_iframe_url, $video_meta ) {
return 'https://player.vimeo.com/video/' . $video_meta['id'] . '?portrait=0&byline=0&title=0';
}
// Filter the permalink for Vimeo
add_filter( 'fve_vimeo_permalink', 'fve_vimeo_permalink', 10, 2 );