Skip to content

Instantly share code, notes, and snippets.

View oscarmorrison's full-sized avatar

Oscar Morrison oscarmorrison

View GitHub Profile
Source: https://publish.obsidian.md/jrd/Globe+Key+QMK
# Adding the Apple 🌐︎ key to QMK keyboards
Apple keyboards have a funky `fn` key with a `🌐︎` globe symbol on them. In most ways this behaves as any other `fn` key, and I've never missed it using a third-party keyboard. Generally, you could just ignore it unless you really wanted quick access to the emoji picker. This changed with macOS Sequoia. The `🌐︎` key is now the default modifier for most
window management shortcuts.
These can be remapped using `Application Shortcuts` in `System Preferences`. However, you cannot add an `fn` modifier and, without it, you often clash with common shortcuts in other applications. There's no way to avoid this and macOS will give priority to the application shortcut.
@oscarmorrison
oscarmorrison / switchGitProtocol.sh
Created January 4, 2019 04:35
A quick bash script to change a repo from ssh to https and vice versa
echo "Opening git repo"
giturl=$(git config --get remote.origin.url)
giturl=$( tr '[A-Z]' '[a-z]' <<< $giturl)
if [[ $giturl == *"https"* ]]
then
echo "Switching repo remote origin url from HTTPS to SSH"
echo $giturl
giturl=${giturl#https://github.com/}
repo=${giturl/\.git}
@oscarmorrison
oscarmorrison / server.py
Last active November 14, 2021 19:32
Python Cat Feeder two servos
#blog.oscarmorrison.com
#Cat feeder (open and close server)
#change the pin, and port here.
from flask import Flask, jsonify
import RPi.GPIO as IO
import time
pinOutOne = 4
#set this two whatever your 2nd servo is in
pinOutTwo = 5
// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.
module.exports = {
config: {
// default font size in pixels for all tabs
fontSize: 12,
// font family with optional fallbacks
@oscarmorrison
oscarmorrison / heroku set .env .sh
Created July 29, 2017 17:32
Set you local config variables for remote heroku
heroku config:set `cat .env`
@oscarmorrison
oscarmorrison / d3Importer.js
Last active March 6, 2024 12:50
Modularly import only the D3.js modules you require
import { line, curve, curveCatmullRom } from "d3-shape";
import { scaleTime, scaleLinear } from "d3-scale";
import { axisBottom, axisLeft } from 'd3-axis';
import { timeParse, isoFormat } from "d3-time-format";
import { select } from "d3-selection";
import { extent, max, min } from "d3-array";
export default {
line: line,
scaleTime: scaleTime,
@oscarmorrison
oscarmorrison / getParamsFromSearchURL.js
Last active July 6, 2017 20:35
Get params from search url
const getParamsFromSearchURL = url => url.slice(1).split('&').reduce((params, pairs) => {
const [key, value] = pairs.split('=');
key && value && (params[key] = getValue(value));
return params;
}, {});
// this parses foo=true -> make true a bool, not a string
const getValue = value => {
value = decodeURIComponent(value);
try {
@oscarmorrison
oscarmorrison / _readme.md
Created May 26, 2017 16:13 — forked from hew/_readme.md
Operator Mono w/ Italics on OSX VIm

Operator Mono w/ Italics on OSX Vim

@oscarmorrison
oscarmorrison / validateEmail.js
Last active May 27, 2017 06:38
ES6 email validation
// regex from http://stackoverflow.com/questions/46155/validate-email-address-in-javascript
const EMAIL_REGEX = /^[-!#$%&'*+\/0-9=?A-Z^_a-z{|}~](\.?[-!#$%&'*+\/0-9=?A-Z^_a-z`{|}~])*@[a-zA-Z0-9](-?\.?[a-zA-Z0-9])*\.[a-zA-Z](-?[a-zA-Z0-9])+$/;
const validateEmail = email => {
return email
&& email.length < 255
&& EMAIL_REGEX.test(email);
};
export default validateEmail;
<!DOCTYPE html>
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/4.4.2/d3.min.js"></script>
<script>
var data = [4,8,15,16,23,42];
</script>
<style type="text/css">