Skip to content

Instantly share code, notes, and snippets.

View maatthc's full-sized avatar

Alexandre Andrade maatthc

  • MaaT Tech
  • Melbourne
View GitHub Profile
@maatthc
maatthc / add_usb_drive_to_retroarch_media_folder_install.sh
Last active March 29, 2024 06:27
LG WebOStv - Play games on RetroArch from USB drive
#!/bin/bash
# === For rooted LG TVs with WebOsBrew installed only ===
#
# On LG WebOStv, RetroArch only have access to a few jailed folders so to run games on a usb drive,
# we need to 'merge' the USB mounting point with one of those jailed folders using OverlayFS.
# The scripts on folder '/var/lib/webosbrew/init.d/' will run after every tv boot.
# Remove the $STARTUP_FOLDER/$SCRIPT_TO_RUN_AFTER_BOOT and reboot to revert the change.
#
# Tested on 7.3.0-03.30.72
#
version: "3.7"
x-vars:
- &TZ
TZ=Australia/Melbourne
- &DnsRestart
restart: always
extra_hosts:
- "tv.home:192.168.0.99"
@maatthc
maatthc / eachine-ex4-bond-ip.py
Last active May 9, 2022 07:27
To connect to Eachine EX4 using Qgroundcontrol/MAVlink running on a computer, first run this script.
import socket
from time import sleep
DRONE_IP = '172.50.10.1'
DRONE_BOND_PORT = 4646
RESET_CMD=b'{"CMD":0,"PARAM":-1}\n'
BOND_CMD=b'{"CMD":89,"PARAM":1}\n'
EXPECTED_SERVER_RESPONSE = '{ "CMD": 89, "PARAM": -1, "RESULT": 1 }'
@maatthc
maatthc / karabiner_Mac_Intel.json
Last active February 3, 2022 00:49
Keyboard Ajazz K680T configuration via Karabiner-Elements on MacOS
{
"global": {
"check_for_updates_on_startup": true,
"show_in_menu_bar": true,
"show_profile_name_in_menu_bar": false
},
"profiles": [
{
"complex_modifications": {
"parameters": {
@maatthc
maatthc / url.test.ts
Created August 30, 2021 04:05
TypeScript Jest Window Location mocking
import urlBuilder from './url'
let location: Location
describe('urlBuilder', () => {
beforeEach(() => {
location = window.location
jest.spyOn(window, 'location', 'get').mockRestore()
})
@maatthc
maatthc / sleep.ts
Created July 17, 2021 09:19
Sleep (or wait) function in TypeScript (^4.3.5)
function sleep(ms: number) {
return new Promise(resolve => setTimeout(resolve, ms, ''))
}
if [ $UID -eq 0 ]; then NCOLOR="red"; else NCOLOR="green"; fi
local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
if [[ $AWS_SESSION_TOKEN ]]; then
AWS="$FG[208] [AWS]$reset_color ";
fi
PROMPT='%{$fg[$NCOLOR]%}%n%{$reset_color%}@%{$fg[cyan]%}%m\
%{$reset_color%}:%{$fg[magenta]%}%~\
$(git_prompt_info) \
@maatthc
maatthc / access-gmail.ts
Last active July 19, 2021 08:46
How to use the Gmail API - Firstly enable the Gmail API on your account: https://developers.google.com/gmail/api/quickstart/nodejs
/* eslint-disable camelcase */
import { Gmail, gmail_v1, GaxiosResponse } from './gmail-client'
const SEARCH_PATTERN = 'My subject is ..'
const init = async () => {
const client = new Gmail()
console.log('Authenticating...')
await client.authorize()
console.log(`Searching for emails that contains ${SEARCH_PATTERN}..`)
@maatthc
maatthc / br.com.maat.vpn.plist
Last active October 29, 2020 14:00
This script runs upon login: Big IP Edge Client on Mac requires only part of McAfee to be running and jamfAgent
<!-- On line 16, replace 'MY_USERNAME' by your own username -->
<!-- Save as ~/Library/LaunchAgents/br.com.maat.vpn.plist -->
<!-- After creating both files, test it running: -->
<!-- $ launchctl load ~/Library/LaunchAgents/br.com.maat.vpn.plist -->
<!-- $ launchctl start br.com.maat.vpn -->
<!-- Check for error using: tail -f /var/log/system.log -->
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
@maatthc
maatthc / lauch.json
Last active October 1, 2020 10:35
Configuration files for Debugging TypeScript Serverless application using Visual Studio Code
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "pwa-node",
"request": "launch",