Skip to content

Instantly share code, notes, and snippets.

@runiq
runiq / Android - Enable ADB from recovery.md
Created November 13, 2020 14:44 — forked from varhub/Android - Enable ADB from recovery.md
Android - Enable ADB from recovery

Android - Enable ADB from recovery

Credits to @TheOnlyAnil-@Firelord[^stackoverflow]

  • Requirements: a) stock recovery + rooted phone b) custom recovery

  • Files changed:

@runiq
runiq / util.lua
Created January 15, 2021 16:49
Neovim: "native" Lua callbacks in mappings
local M = {}
M._cbs = {}
--- Saves a Lua function as a callback and returns a string that can be used to
--- run that function.
---
---@param fn Callback
---@return string
function M.lua_callback(fn)
assert(type(fn) == 'function', tb('fn must be a function'))
@runiq
runiq / .bash_profile
Created January 20, 2021 00:04
How I handle envvars
[[ -f "$HOME/.profile" ]] && source "$HOME/.profile"
[[ $- == *i* && -f "$HOME/.bashrc" ]] && source "$HOME/.bashrc"
@runiq
runiq / fix-floating-preview.lua
Last active March 16, 2021 18:16
Sanity check
-- 1. Clone https://github.com/neovim/neovim/pull/12720
-- 2. Run with `nvim -u NONE fix-floating-preview.lua '+luafile %'`
-- 3. press F7 twice.
-- 4. Does it echo your current line (including line numbers!) to the :messages
-- pane before switching into the floating window?
function __beep() return vim.lsp.util.open_floating_preview({'foo', 'boo'}, 'lua', {focus_id='beep'}) end
vim.api.nvim_buf_set_keymap(0, '', '<f7>', '<cmd>lua __beep()<cr>', {silent = true, noremap = true})
vim.wo.number = true
@runiq
runiq / add_incr_print.lua
Last active March 17, 2021 00:46
Automatically numbered print statements
local counter = 1
local M = {}
--- Creates a function to insert customized numbered print statements.
---
--@param context (string, default "print('%d')") The format string for the debug
--- statement. Should contain a single `%d`, which will be the insertion point
--- of the current counter value.
function M.debug_statement_factory(context)
local context = context or [[print('%d')]]
@runiq
runiq / README.md
Last active November 17, 2023 00:40
๐ŸŒˆ

HOW TO ๐ŸŒˆ

  1. Save as ๐ŸŒˆ.lua
  2. cd $(dirname path/to/๐ŸŒˆ.lua)
  3. nvim ๐ŸŒˆ.lua
  4. :luafile %
  5. Press F5 to ๐ŸŒˆ

The F5 bit is just for demonstration. In an actual statusline, you'll want to uncomment line 65 so it actually checks for LSP messages.