Skip to content

Instantly share code, notes, and snippets.

View tomoe-mami's full-sized avatar

Tomoe Mami tomoe-mami

View GitHub Profile
@tomoe-mami
tomoe-mami / anykey.lua
Last active June 28, 2019 01:15
"Press any key" example in Lua with POSIX module.
local bit = require "bit"
local termio = require "posix.termio"
local unistd = require "posix.unistd"
local inspect = require "inspect"
local t = termio.tcgetattr(unistd.STDIN_FILENO)
local o_vmin, o_vtime, o_lflag = t.cc[termio.VMIN], t.cc[termio.VTIME], t.lflag
io.stdout:write("Press any key... ")
@tomoe-mami
tomoe-mami / hdata_test.lua
Created October 6, 2017 10:20
first attempt at making hdata less annoying
w, script_name = weechat, "hdata_test"
hdata = {
meta = {
__index = function (tb, name)
local var_type = tb._vars[name]
if not var_type then
return
end
if var_type == "hashtable" then
@tomoe-mami
tomoe-mami / test.lua
Created July 13, 2016 18:54
test script for "smooth" resize a bar
w = weechat
w.register("test", "singalaut", "0.1", "WTFPL", "", "", "")
function resize_bar_start_cb(_, _, tb)
local ptr_bar = w.bar_search(tb._bar_name)
if ptr_bar == "" then
return w.WEECHAT_RC_OK
end
-- bar_window is not bar with type window but an area of screen that is
w, script_name = weechat, "mpd_bar_item"
info = {}
function item_cb()
local symbols = { play = "▶", pause = "▮▮", stop = "■" }
info.playback_state = symbols[info["status.state"]]
local fmt = "MPD${color:bar_delim}: "
local flags = {
@tomoe-mami
tomoe-mami / greasemonkey-webm-buffer-bar.js
Last active May 14, 2016 23:56
Buffer bar for gfycat and gifv using greasemonkey+stylish
// ==UserScript==
// @name gfycat and gifv buffer bar
// @namespace https://github.com/tomoe-mami
// @version 0.3
// @description buffer bar for gfycat and imgur's gifv
// @include /^https?://(www\.)?gfycat\.com/.+$/
// @include /^https?://i\.imgur\.com/[^.]+\.gifv$/
// @grant none
// ==/UserScript==
@tomoe-mami
tomoe-mami / info_time.lua
Last active August 29, 2015 14:23
Weechat script for adding ${info:time} variable into eval
-- Example usage: /eval -n ${info:time,%Y-%m-%d %H:%M:%S}
function info_cb(_, _, format)
return os.date(format)
end
if weechat.register("info_time", "singalaut", "0.1", "WTFPL", "Add ${info:time} variable to eval", "", "") then
weechat.hook_info(
"time",
"Gets current date and time info",
Running 287 testsERROR: JavaScript error: simulation/components/GuiInterface.js line 379
ReferenceError: IID_AlertRaiser is not defined
(-1,10)@simulation/components/GuiInterface.js:379
()@simulation/components/tests/test_GuiInterface.js:421
In TestComponentScripts::test_scripts:
../../../source/pch/test/../../../source/simulation2/components/tests/test_scripts.h:43: Error: Test failed: L"Running script simulation/components/tests/test_GuiInterface.js"
../../../source/pch/test/../../../source/simulation2/components/tests/test_scripts.h:43: Error: Assertion failed: scriptInterface.LoadScript(pathname, content)
............................................................................................................................................................................................
..................................................................................................
@tomoe-mami
tomoe-mami / lsthumb.sh
Last active December 15, 2015 12:49
showing file thumbnails in terminology
#!/bin/sh
WIDTH=10
HEIGHT=4
LABEL="yes" # show filename under thumbnail
VIDEO="no" # don't show video thumbnail. only show generic icon
CHAR="."
if [ ! "$TERMINOLOGY" = "1" ]; then
echo "This script only works in Terminology" >&2
#!/bin/sh
WIDTH=6
HEIGHT=3
CHAR="#"
for FILENAME in $*; do
ABSPATH="$(realpath "$FILENAME")"
echo -ne "\e}it$CHAR$WIDTH;$HEIGHT;$ABSPATH\0"