Skip to content

Instantly share code, notes, and snippets.

View ybbond's full-sized avatar
🎵
The Trees and The Wild - Zaman, zaman

Yohanes Bandung Bondowoso ybbond

🎵
The Trees and The Wild - Zaman, zaman
View GitHub Profile
@numToStr
numToStr / au.lua
Last active August 20, 2023 05:15
Neovim autocmd in lua
--
-- Move this file to your neovim lua runtime path ie. ~/.config/nvim/lua/au.lua
--
local cmd = vim.api.nvim_command
local function autocmd(this, event, spec)
local is_table = type(spec) == 'table'
local pattern = is_table and spec[1] or '*'
local action = is_table and spec[2] or spec
if type(action) == 'function' then
@czoins
czoins / Dart.tmLanguage
Last active February 1, 2024 09:53
Dart syntax highlighting for Sublime Text ported from VS Code's Dart plugin (https://github.com/Dart-Code/Dart-Code/blob/master/syntaxes/dart.json). Place in "Sublime Text 3\Packages\User" or "Sublime Text\Packages\User". Create the folder "User" if it doesn't exist. Check "https://www.sublimetext.com/docs/side_by_side.html" if you don't know wh…
<plist version="1.0">
<dict>
<key>name</key>
<string>Dart</string>
<key>fileTypes</key>
<array>
<string>dart</string>
</array>
<key>scopeName</key>
<string>source.dart</string>
@ybbond
ybbond / hjkl_navigation.json
Last active July 26, 2021 06:50
Complex modification for Karabiner Elements. H to →, J to ↓, K to ↑, L to →
{
"title": "HJKL to Arrow Navigation",
"rules": [
{
"description": "HJKL to Arrow Navigation",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "h",
@waydabber
waydabber / chbrt.m
Last active October 7, 2022 09:22
This should change the brightness level of a single external display connected to an M1 MBP or MBA relative to the current setting using DDC/CI. Reportedly does not work on M1 Mini.
@import Darwin;
@import Foundation;
@import IOKit;
/*******
This should change the brightness level of a single external display connected to an M1 MBP or MBA relative to the current setting using DDC/CI. Reportedly does not work on M1 Mini.
Credits to @tao-j and @alin23
Compile:
@tao-j
tao-j / brt.m
Last active September 2, 2023 02:17
M1 External Monitor Brightness Control over DDC
@import Darwin;
@import Foundation;
@import IOKit;
// clang -fmodules -o brt brt.m && ./brt
// credit to @zhuowei for discovering the following APIs
typedef CFTypeRef IOAVServiceRef;
extern IOAVServiceRef IOAVServiceCreate(CFAllocatorRef allocator);
extern IOReturn IOAVServiceCopyEDID(IOAVServiceRef service, CFDataRef* x2);
@ttscoff
ttscoff / pins-bookmarklet.js
Created June 29, 2021 13:04
Bookmarklet for Pins.app (1.6+)
// Bookmarklet for [Pins.app](https://get-pins.app/) (requires version 1.6+)
// Removes Google Analytics strings
// Removes Product Hunt query string
// Prefers canonical url if defined
// Uses selected text for description, falling back to meta description
// Removes pipes (|) from title
// To allow use on any website in Firefox, go to about:config and set security.external_protocol_requires_permission to false
// Copy this to your URL bar:
javascript:!function(){function e(e){var n="pins://launch?screen=newPost&",i=o();""===i&&(i=r()),n+="url="+encodeURIComponent(e),n+="&",n+="title="+encodeURIComponent(t()),n+="&",n+="description="+encodeURIComponent(i),document.location.href=n}function t(){var e=document.title;return e.replace(/\|/g,"-")}function n(){for(var e=document.getElementsByTagName("link"),t=0;t<e.length;t++)if(e[t].attributes.hasOwnProperty("rel")&&"canonical"===e[t].attributes.rel.textContent.toLowerCase())return e[t].attributes.href.textContent;var n,o=document.location.href.split(/[?&]([^&]+)/
@mikepqr
mikepqr / README.md
Last active September 27, 2021 04:19
Make printouts from Firefox Reader mode look like NYRB artices

printout with this stylesheet

See this tweet for how I use this.

To install in Firefox:

  1. If it doesn't already exist, create a folder called chrome in your profile folder. The easiest way to find your profile folder is in about:profiles (there's a "Show in Finder" link for the folder on macOS). Be sure to choose the right profile is you have more than one.

  2. Put userContent.css above in the chrome folder you just created.

@tomhicks
tomhicks / plink-plonk.js
Last active March 18, 2024 02:23
Listen to your web pages
@Lukas238
Lukas238 / How to generate a PGP Key.md
Last active April 15, 2024 05:09
How to generate a PGP Key
@bgadrian
bgadrian / hugo_lazy_img.md
Last active May 1, 2020 19:46
Hugo lazy image loading

I presume the images are bundled as post resources in the ./images/ folder.

It creates a new version at 5% of its original quality that is fetched in the initial page load. When and if the original image is loaded by the browser it will replace the low quality one.

{{< lazyimg "images/1.jpeg" >}} {{< lazyimg "images/1.jpeg" "caption" >}}