Skip to content

Instantly share code, notes, and snippets.

View nathanbirrell's full-sized avatar

Nathan Birrell nathanbirrell

View GitHub Profile
@anastaciocintra
anastaciocintra / Compare two data objects .md
Last active November 7, 2024 19:20
Compare two objects JS

Compare two data objects / arrays in javascript and/or typescript regardless of the order of the data;

When to use:

  • When you need compare two "json" objects to know if it have same data.
  • When the order of the array doesn't matters ie. [1,2] should be equal [2,1], but it is configurable.
  • lightweight - just one small .js file

when not to use:

  • when you need to compare more complex objects, with functions, for example.
@weliveindetail
weliveindetail / rename_exif.py
Created November 25, 2021 12:26
Python3 script to rename files based on EXIF info
#!/usr/local/bin/python3
import os
from PIL import Image
from hachoir.parser import createParser
from hachoir.metadata import extractMetadata
# Parameters
dir = '/path/to/media/files'
image_extensions = ['.jpg']
video_extensions = ['.mp4']
@max10rogerio
max10rogerio / slugify.ts
Last active September 29, 2024 22:27
Typescript slug function
// MIT License
// Copyright (c) 2023 Max Rogério
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
@findmory
findmory / README.md
Last active October 3, 2024 06:36
Send Trackpad gestures over Barrier/Synergy using BetterTouchTool

Problem: Controlling a remote Mac desktop using a tool like Barrier or Synergy doesn't allow for trackpad gestures to be sent to the client machine.

Solution: Use Better Touch Tool on host machine to handle the gestures and send a remote command to the client machine.

Steps to setup:

[1] On the CLIENT machine in BTT setup these Named triggers:

@bodokaiser
bodokaiser / context.ts
Last active August 10, 2023 01:00
React Hook integration for AWS Amplify Auth
import React from "react"
import { CognitoUser } from "@aws-amplify/auth"
import { useAuth } from "./hooks"
import { SignInInput } from "./types"
interface AuthState {
user: CognitoUser | null
signIn(input : SignInInput): Promise<void>
signOut(): Promise<void>
@jmadden91
jmadden91 / LaPavoni.ino
Last active March 25, 2020 05:56
La Pavoni Heater Control
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <EEPROM.h>
#include <ESP8266mDNS.h>
#include <WiFiUdp.h>
#include <ArduinoOTA.h>
int a = 1;
int b = 1;
@sorenlouv
sorenlouv / mac-os-mapping-keys-uk-keyboard.md
Last active November 28, 2024 13:50
Map tilde sign (`) to section sign (§) on MacOS (useful for UK keyboards)
hidutil property --set '{"UserKeyMapping":[{"HIDKeyboardModifierMappingSrc":0x700000064,"HIDKeyboardModifierMappingDst":0x700000035},{"HIDKeyboardModifierMappingSrc":0x700000035,"HIDKeyboardModifierMappingDst":0x700000064}]}'
@sleepyfox
sleepyfox / 2019-07-25-users-hate-change.md
Last active September 13, 2024 08:39
'Users hate change'

'Users hate change'

This week NN Group released a video by Jakob Nielsen in which he attempts to help designers deal with the problem of customers being resistant to their new site/product redesign. The argument goes thusly:

  1. Humans naturally resist change
  2. Your change is for the better
  3. Customers should just get used to it and stop complaining

There's slightly more to it than that, he caveats his argument with requiring you to have of course followed their best practices on product design, and allows for a period of customers being able to elect to continue to use the old site, although he says this is obviously only a temporary solution as you don't want to support both.

@dongri
dongri / uninstall-netskope.sh
Last active December 12, 2024 09:44
uninstall netskope
#!/bin/sh
sudo ps aux | grep Netskope | grep -v grep | awk '{ print "kill -9", $2 }' | sudo sh
echo '[✓] Kill Netskope Process'
sudo rm -rf /Applications/Remove\ Netskope\ Client.app
echo '[✓] Removed Remove Netskope Client.app'
sudo rm -rf /Library/Application\ Support/Netskope
echo '[✓] Removed Agent of Netskope Client.app'
@jaydenseric
jaydenseric / DeferredQuery.jsx
Created July 2, 2019 03:34
A <DeferredQuery> react component that loads a react-apollo <Query> on demand.
import React from 'react'
import { Query } from 'react-apollo'
export const DeferredQuery = ({ children, ...props }) => {
const [skip, setSkip] = React.useState(true)
const load = () => setSkip(false)
return (
<Query skip={skip} {...props}>
{args => children({ ...args, load })}
</Query>