Skip to content

Instantly share code, notes, and snippets.

Avatar

Jamie Hamel‑Smith jamiehs

View GitHub Profile
@jamiehs
jamiehs / find.sh
Created Aug 8, 2019
Find mtime quirks
View find.sh
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 Jul 14, 2019
Dactyl Manuform with 5x6/5x7 and aviator connections
View dactyl.clj
(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 Jul 12, 2019
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.
View rename-prefix.sh
# 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 Jun 29, 2019
Proto-Pasta Powder Puff Unicorn Settings for PrusaSlicer
View proto-pasta-ppu-htpla.ini
# 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 Sep 14, 2018
When Node is installing dependancies, there is a variable we can use to conditionally run something in production/!production
View package.json
{
"scripts": {
"postinstall": "if [ -n \"$npm_config_production\" ]; then npm run build; fi"
}
}
@jamiehs
jamiehs / in_this_language.md
Last active Apr 21, 2017
In This Language (add your comments or suggestions)
View in_this_language.md

Input

foo bar baz qux

Required Output

Hello Foo
Hello Bar
Hello Baz
Hello Qux
@jamiehs
jamiehs / .my.cnf
Created Dec 8, 2016
Place this file in your home directory (OS X) and you will not need to specify a MySQL password for your local client.
View .my.cnf
[client]
user='root'
password='123'
View LoremText.sublime-settings
{
// 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 Nov 10, 2015
A novel method of finding the height of an absolutely positioned element. From: http://stackoverflow.com/a/20791125
View absolute-element-height.js
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 Oct 8, 2015
Force https for the scheme-relative URLs in Fluid Video Embeds (requires 1.2.9 or higher)
View functions.php
<?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 );
You can’t perform that action at this time.