Skip to content

Instantly share code, notes, and snippets.

View sunsetsonwheels's full-sized avatar

Nam sunsetsonwheels

View GitHub Profile
@sunsetsonwheels
sunsetsonwheels / home_end_macos.json
Last active September 21, 2022 13:48
Home & End for macOS (Karabiner Elements complex modification)
{
"title": "Home & End for macOS",
"rules": [
{
"description": "Make the Home & End key behave like they would on PCs",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "end"
@sunsetsonwheels
sunsetsonwheels / Collapse Instagram Sidebar.js
Last active January 9, 2022 12:08
Collapse Instagram sidebar (thanks to simplified-twitter)
// ==UserScript==
// @name Collapse Instagram Suggestions
// @description This collapses the Instagram suggestions sidebar to make everything centered.
// @match *://*.instagram.com/
// @run-at document-end
// ==/UserScript==
function update() {
const width = Math.min(document.documentElement.offsetWidth || 800, 800)
if (window.innerWidth === width && document.documentElement.clientWidth === width) return
@sunsetsonwheels
sunsetsonwheels / Water Intake Widget.js
Last active October 3, 2021 15:58
Scriptable water intake widget
const iCloudData = importModule("Scriptable iCloud Data");
const logFileName = "water.json";
let waterData = args.shortcutParameter;
if (waterData) {
iCloudData.writeJSONFile(logFileName, waterData);
} else {
if (iCloudData.doesFileExist(logFileName)) {
waterData = iCloudData.readJSONFile(logFileName);
}
@sunsetsonwheels
sunsetsonwheels / Scriptable iCloud Data.js
Created October 3, 2021 15:52
Scriptable iCloud Data
const fileManager = FileManager.iCloud();
const dataDirectoryPath = fileManager.joinPath(fileManager.documentsDirectory(), "data");
if (!fileManager.isDirectory(dataDirectoryPath)) fileManager.createDirectory(dataDirectoryPath);
function concatPath(fileName) {
return fileManager.joinPath(dataDirectoryPath, fileName);
}
module.exports.doesFileExist = (fileName) => {
@sunsetsonwheels
sunsetsonwheels / Music.swift
Created July 29, 2021 02:28
macOS Monterey Music.app ScriptingBridge
import AppKit
import ScriptingBridge
@objc public protocol SBObjectProtocol: NSObjectProtocol {
func get() -> Any!
}
@objc public protocol SBApplicationProtocol: SBObjectProtocol {
func activate()
var delegate: SBApplicationDelegate! { get set }
@sunsetsonwheels
sunsetsonwheels / keybase.md
Created February 10, 2020 12:40
keybase.md

Keybase proof

I hereby claim:

  • I am jkelol111 on github.
  • I am jkelol111 (https://keybase.io/jkelol111) on keybase.
  • I have a public key ASAibMXKguaiM71tVV9Y6JjRYe4FHeEJcRVx0SzgVHs3gQo

To claim this, I am signing this object:

@sunsetsonwheels
sunsetsonwheels / test.html
Created August 10, 2019 13:18
'Pages' nav in KaiOS
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,user-scalable=no">
<title>"Pages" in KaiOS</title>
<link rel="stylesheet" href="./window.css">
</head>
<body>
<header class="header">
from gpiozero import MCP3008, LED, Button
from time import localtime, sleep
from lcddriver import lcd
from json import load
from os import getcwd
from os.path import join
from pyowm import OWM
print("-------------------------------------------------------------")
print("-------------------------------------------------------------")
var optionMenuOpen = false;
var optionMenuIndex = 0;
document.addEventListener("DOMContentLoaded", () => {
});
function backHandler() {
if(optionMenuOpen) {
document.getElementById("optionMenu-blur").style.display = "none";
document.getElementById("optionMenu").style.display = "none";
@sunsetsonwheels
sunsetsonwheels / home.html
Created June 21, 2019 02:26
[KaiOS] I can't navigate the option menu!
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,user-scalable=no,initial-scale=1">
<title>Runner</title>
<link rel="stylesheet" href="/css/window.css"/>
<link rel="stylesheet" href="/css/home.css"/>
<link rel="manifest" href="/manifest.webapp"/>
<link rel="localization" href="/locales/runner.{locale}.properties"/>