Skip to content

Instantly share code, notes, and snippets.


Lio李歐 lionello

View GitHub Profile
lionello / translatekeycodes.swift
Created Jan 18, 2022 — forked from ArthurYidi/translatekeycodes.swift
virtual key codes to unicode characters
View translatekeycodes.swift
private static func keyCodeToString(keyCode: CGKeyCode, eventModifiers: Int) -> String? {
let curKeyboard = TISCopyCurrentKeyboardInputSource().takeRetainedValue()
let rawLayoutData = TISGetInputSourceProperty(curKeyboard, kTISPropertyUnicodeKeyLayoutData)
let layoutData = unsafeBitCast(rawLayoutData, to: CFData.self)
let keyboardLayoutPtr = unsafeBitCast(CFDataGetBytePtr(layoutData), to: UnsafePointer<UCKeyboardLayout>.self)
var deadKeyState: UInt32 = 0
var actualStringLength = 0
var unicodeString: [UniChar] = [0, 0, 0, 0]
View DefaultKeyBinding.dict
/* put this file in ~/Library/KeyBindings/ */
/* Home */
"\UF729" = "moveToBeginningOfLine:";
"^\UF729" = "moveToBeginningOfDocument:";
"$\UF729" = "moveToBeginningOfLineAndModifySelection:";
"^$\UF729" = "moveToBeginningOfDocumentAndModifySelection:";
/* End */
View .emacs
(require 'package)
(add-to-list 'package-archives '("org" . ""))
(add-to-list 'package-archives '("melpa" . ""))
(add-to-list 'package-archives '("melpa-stable" . ""))
(setq package-enable-at-startup nil)
View igloo.dxf
"DXF R12 Output" (
lionello /
Last active Jul 7, 2021 — forked from blixt/
Playing SteamVR games on the Oculus Quest

Playing SteamVR games on the Oculus Quest, without owning a PC

Setting up your Virtual Machine

We'll be creating a new Virtual Machine on Microsoft's cloud platform, Azure. The VM will have a beefy GPU just like a home computer so it can be used for playing games.

  1. Go to [the Azure portal][azure] and sign up or log in.

  2. If you are on a Free account, first go to Subscriptions and upgrade it to a Pay-as-you-go plan. Don't worry, you will get to keep any free credits you have. Azure's interface is a bit slow so this will take a minute.

    ⚠️ Make sure to not include any support plan because they will charge you monthly!

lionello / stashd.d
Last active May 11, 2021
Tool to find GIT stashes containing changes to specified file(s)
View stashd.d
#!/usr/bin/env rdmd
// Get rdmd from (or brew, nix, apt, yum)
// Copyright Lionello Lunesu. Placed in the public Domain.
import std.stdio : writeln;
int main(string[] args) {
import std.process : pipeProcess, wait, Redirect;
View Loan Project.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
lionello /
Last active Apr 7, 2020
My FISH prompt (avoids shortened path names, unless too long or in subshells)
# name: Classic + Vcs (custom)
# author: Lily Ballard & Lionello Lunesu
function fish_prompt --description 'Write out the prompt'
set -l last_pipestatus $pipestatus
set -l normal (set_color normal)
# Color the prompt differently when we're root
set -l color_cwd $fish_color_cwd
set -l prefix
lionello / cas128.c
Last active Jan 12, 2020
__sync_val_compare_and_swap for __uint128_t GCC built-in
View cas128.c
__sync_val_compare_and_swap that works with __uint128_t, by Lionello Lunesu.
Placed in the public domain
#undef NDEBUG
#include <assert.h>
inline __uint128_t InterlockedCompareExchange128( volatile __uint128_t * src, __uint128_t cmp, __uint128_t with )
__asm__ __volatile__
lionello / .direnvrc
Last active Aug 6, 2019 — forked from adisbladis/.direnvrc
Direnv nix cache. Put this file in your HOME folder.
View .direnvrc
# Cache nix-shell environment
# - watches shell.nix (or default.nix), ~/.direnvrc and .envrc
# - based on
use_nix() {
local shell_file=$(test -f shell.nix && echo shell.nix || echo default.nix)
if [[ ! -f "$shell_file" ]]; then return; fi