Skip to content

Instantly share code, notes, and snippets.

@trygveaa
trygveaa / script_config.js
Last active October 23, 2022 19:32
WeeChat scripts to test config section callback read with null value in all the scripting languages
function my_section_read_cb(data, config_file, section, option_name, value) {
weechat.print("", "js: value: '" + value + "', is_null: " + (value === null) + ", is_undefined: " + (value === undefined));
return weechat.WEECHAT_CONFIG_OPTION_SET_OK_CHANGED;
}
weechat.register("script_config_js", "trygveaa", "0.0.1", "MIT", "", "", "")
var config_file = weechat.config_new("script_config_js", "", "")
var config_section = weechat.config_new_section(
#!/bin/bash
title="$1"
body="${2/&/&}"
body="${body/</&lt;}"
body="${body/>/&gt;}"
if [ -n "$TMUX" ]; then
printf '\ePtmux;\e\e]99;i=1:d=0;%s\e\e\\\e\\' "$title" >/dev/tty
printf '\ePtmux;\e\e]99;i=1:d=1:p=body;%s\e\e\\\e\\' "$body" >/dev/tty
@trygveaa
trygveaa / script_config.js
Created March 3, 2022 16:30
WeeChat scripts to test config_new_option with null in all the scripting languages
weechat.register("script_config", "trygveaa", "0.0.1", "MIT", "", "", "")
var config_file = weechat.config_new("slack", "", "")
var config_team_default = weechat.config_new_section(
config_file, "team_default", 0, 0, "", "", "", "", "", "", "", "", "", ""
)
var config_team = weechat.config_new_section(
config_file, "team", 0, 0, "", "", "", "", "", "", "", "", "", ""
@trygveaa
trygveaa / gist:59308f0f637d3c64873a20355e0c2859
Last active October 11, 2022 21:14
Render image in WeeChat with kitty icat
/exec -bg kitty +kitten icat --transfer-mode stream --place 10x10@0x0 /path/to/image
# Default programs
export TERMINAL='kitty -1'
export BROWSER='browser'
export EDITOR='vim'
export PAGER='less -RS'
export LESS='FRS'
export SYSTEMD_LESS='FRSM'
export RIPGREP_CONFIG_PATH=~/.config/ripgrep/config
export FZF_DEFAULT_COMMAND='fd --hidden --follow --exclude .git'
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"
@trygveaa
trygveaa / url_image_view.py
Created June 16, 2020 20:26
Kitty kitten to download an image url and display
from kittens.hints.main import main as hints
from kittens.icat.main import main as icat
from kitty.utils import screen_size_function
import time
screen_size = screen_size_function()
def main(args):
ss = screen_size()
hints_result = hints('')
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@trygveaa
trygveaa / original-polygon.geojson
Last active May 6, 2021 07:01
Turf simplify bug
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import weechat
lorem_ipsum = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam dapibus dolor ultricies malesuada semper. Nulla ac augue orci. Proin iaculis mi ipsum, a dapibus est porta vel. Donec gravida et elit sed iaculis. Praesent id mollis neque. Sed hendrerit rutrum odio, eu eleifend dui interdum ac. Donec nec sollicitudin enim. Aliquam in magna sit amet lectus tincidunt finibus ac a massa. Donec sed nunc tortor. Maecenas egestas facilisis urna, volutpat ultrices orci sagittis nec. Suspendisse aliquam at diam vel malesuada. Morbi a eros sed risus condimentum maximus. Mauris maximus velit in nibh dignissim tempor. Quisque lobortis finibus nunc, nec malesuada quam vehicula in. Integer quis eros nulla.'
def change_line_command_cb(data, current_buffer, args):
own_lines = weechat.hdata_pointer(weechat.hdata_get('buffer'), buffer, 'own_lines')
line_pointer = weechat.hdata_pointer(weechat.hdata_get('lines'), own_lines, 'last_line')
data = weechat.hdata_pointer(weechat.hdata_get('lin
@trygveaa
trygveaa / package.json
Created March 18, 2019 12:12
yarn upgrade issue
{
"dependencies": {
"nuxt-ts": "^2.4.5",
"typescript": "3.3.1",
"webpack": "^4.29.3"
}
}