Skip to content

Instantly share code, notes, and snippets.

View seandewar's full-sized avatar
🏖️
Largely inactive for a while

Sean Dewar seandewar

🏖️
Largely inactive for a while
View GitHub Profile
@seandewar
seandewar / depreCATE.lua
Created May 17, 2024 08:45
Are deprecation messages in Neovim too annoying? Then enhance them with this little script!
local 🏷️ 🪐 = vim.api.nvim_create_namespace('depreCATE')
vim.deprecate = function(name, alternative, version, plugin, backtrace)
local lines = {
"",
"🚨 🐧📣 W A R N I N G ! ! ! ! 🚨",
"",
"",
"😱 " .. name .. " IS DEPRECATED!!!! 😱",
"",
@seandewar
seandewar / global-winsep.vim
Created November 19, 2023 22:51
Remove all Neovim statuslines and add a window separator at the bottom of the screen.
" Quick 'n dirty Vim script for Neovim that removes all statuslines and creates
" a global statusline acting as a fake window separator.
" Also sets 'cmdheight' to 0.
hi! link StatusLine WinSeparator
hi! link StatusLineNC WinSeparator
func! Stl() abort
let hc = &ambw == 'single' ? '─' : '-'
let uc = &ambw == 'single' ? '┴' : '-'
@seandewar
seandewar / emojimode.lua
Created September 26, 2023 20:59
😂 Emojimode for Neovim 0.10+ 😂 (Run with `:Emojimode`)
local api = vim.api
local is_on = false
local emoji_width = api.nvim_strwidth "😂"
local ns = api.nvim_create_namespace "emojimode"
api.nvim_create_user_command("Emojimode", function()
is_on = not is_on
api.nvim_set_decoration_provider(ns, {
@seandewar
seandewar / kitty_scrollback_pager.lua
Created July 19, 2023 22:42
Neovim as a scrollback pager for Kitty. (Tested on Nvim 0.10)
-- Use Neovim as a scrollback pager for Kitty, allowing the
-- buffer to be manipulated as you wish. Configure as:
--
-- scrollback_pager nvim +'source <path to this script>.lua'
local api = vim.api
local orig_buf = api.nvim_get_current_buf()
local term_buf = api.nvim_create_buf(false, true)
api.nvim_set_current_buf(term_buf)
@seandewar
seandewar / hide_scroll.lua
Last active October 14, 2022 22:39
Temporarily hide the cursor when scrolling with the mouse wheel off-screen in Neovim v0.8
-- This script temporarily hides the 'cursorline' (and cursor if 'tgc' is set) if the cursor
-- would be scrolled outside of the window viewport when using the mouse wheel.
--
-- Written for @deagle.50:matrix.org for use with Neovide's smooth scrolling feature. :)
-- Tested using Neovim v0.8.
--
-- TODO: if the window is split before restoring, the hidden 'cul' state will leak into the new
-- window. Can probably be fixed with some autocmd hackery.
local api, fn, keymap = vim.api, vim.fn, vim.keymap
@seandewar
seandewar / mandelbrot.glsl
Created July 26, 2020 16:51
Simple mandelbrot shader for shadertoy.com
// max number of iterations to use for computing mandelbrot
const uint maxIterations = 20u;
// sampling level for regular grid multisample anti-aliasing; 1 disables. the
// number of samples used is the square of this number (e.g: 4u is MSAA 16x)
const uint msaaLevel = 2u;
vec3 mandelbrot(const vec2 c)
{
vec2 z = vec2(0.);
@seandewar
seandewar / quick-convert.bat
Last active May 8, 2019 14:31
Windows Batch file for converting supported video files to MP4 quickly using ffmpeg (without re-encoding). Useful for converting OBS FLV files to MP4.
@echo off
rem Windows Batch file for converting supported video files to MP4 quickly
rem using ffmpeg (without re-encoding). Useful for converting OBS FLV to MP4
rem
rem Recommended directory structure for OBS recordings:
rem
rem OBS Recordings
rem |-- unconverted
rem `-- (Configure OBS to save FLVs to this folder)
rem |-- converted
@seandewar
seandewar / highalch.py
Last active May 7, 2019 19:48
highalch.py
import urllib2, json, datetime, operator
def sp_to_ha(sp):
return int(0.6 * sp) # effectively an int floor if +ve (which it should be)
def fetch_item_price(id):
response = urllib2.urlopen('http://api.rsbuddy.com/grandExchange?a=guidePrice&i=%d' % id)
return json.loads(response.read())
@seandewar
seandewar / coders_strike_back_gold.rs
Last active September 27, 2019 15:31
Code for a bot for Coders Strike Back in Gold Tier (codingame.com) written in Rust.
use std::{io, option, vec, cmp};
macro_rules! print_err {
($($arg:tt)*) => (
{
use std::io::Write;
writeln!(&mut ::std::io::stderr(), $($arg)*).ok();
}
)
;;; init.el --- Sean Dewar's GNU Emacs 24.3+ configuration
;;; Commentary:
;; Sean Dewar's (seandewar @ github) init.el configuration.
;;
;; Feel free to use whatever you want from this configuration file.
;; Always a work in progress!
;;; Code: