Skip to content

Instantly share code, notes, and snippets.

View norcalli's full-sized avatar

Ashkan Kiani norcalli

View GitHub Profile
@norcalli
norcalli / gist:bc7fb4f7b451e6d6819e
Last active August 29, 2015 14:18
Button presser
var tens_el = document.getElementById("thebutton-s-10s");
var secs_el = document.getElementById("thebutton-s-1s");
var secs = function() { return 10*+tens_el.innerText + +secs_el.innerText; }
var b = document.getElementById("thebutton");
function pressIt() { b.click(); }
function tooLate() {
var t = new Date();
t.setSeconds(t.getSeconds() + 2)
return t.getDate() == 2;
@norcalli
norcalli / get_objects.sh
Created May 21, 2016 00:20
Get query object for leapfin
#!/bin/bash
test -z "$1" -o -z "$2" && {
echo "Usage: $0 <client_no> <auth_key>" >&2
exit 1
}
CLIENT_NO="$1"
AUTH_KEY="$2"
2019-04-02 03:16:59 - [sway/main.c:152] Linux zephyr 5.0.5-arch1-1-ARCH #1 SMP PREEMPT Wed Mar 27 17:53:10 UTC 2019 x86_64 GNU/Linux
2019-04-02 03:16:59 - [sway/main.c:168] Contents of /etc/os-release:
2019-04-02 03:16:59 - [sway/main.c:152] NAME="Arch Linux"
2019-04-02 03:16:59 - [sway/main.c:152] PRETTY_NAME="Arch Linux"
2019-04-02 03:16:59 - [sway/main.c:152] ID=arch
2019-04-02 03:16:59 - [sway/main.c:152] BUILD_ID=rolling
2019-04-02 03:16:59 - [sway/main.c:152] ANSI_COLOR="0;36"
2019-04-02 03:16:59 - [sway/main.c:152] HOME_URL="https://www.archlinux.org/"
2019-04-02 03:16:59 - [sway/main.c:152] DOCUMENTATION_URL="https://wiki.archlinux.org/"
2019-04-02 03:16:59 - [sway/main.c:152] SUPPORT_URL="https://bbs.archlinux.org/"
2019-04-02 05:42:35 - [sway/main.c:152] Linux zephyr 5.0.5-arch1-1-ARCH #1 SMP PREEMPT Wed Mar 27 17:53:10 UTC 2019 x86_64 GNU/Linux
2019-04-02 05:42:35 - [sway/main.c:168] Contents of /etc/os-release:
2019-04-02 05:42:35 - [sway/main.c:152] NAME="Arch Linux"
2019-04-02 05:42:35 - [sway/main.c:152] PRETTY_NAME="Arch Linux"
2019-04-02 05:42:35 - [sway/main.c:152] ID=arch
2019-04-02 05:42:35 - [sway/main.c:152] BUILD_ID=rolling
2019-04-02 05:42:35 - [sway/main.c:152] ANSI_COLOR="0;36"
2019-04-02 05:42:35 - [sway/main.c:152] HOME_URL="https://www.archlinux.org/"
2019-04-02 05:42:35 - [sway/main.c:152] DOCUMENTATION_URL="https://wiki.archlinux.org/"
2019-04-02 05:42:35 - [sway/main.c:152] SUPPORT_URL="https://bbs.archlinux.org/"
@norcalli
norcalli / yay-update-ignore-errors
Last active February 22, 2023 09:34
A wrapper script to run yay and incrementally build a list of packages to ignore if they error out.
#!/bin/sh
# Wrapper script around yay to try to ignore errors
# Copyright © 2019 Ashkan Kiani
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
#!/bin/sh
fuser -sk -SIGINT "$0"
test "$1" = off && exit 0
[ "${FLOCKER}" != "$0" ] && exec env FLOCKER="$0" flock -enx "$0" "$0" "$@" || :
exec wf-recorder -f ~/screens/vids/vid-$(date +"%Y-%m-%d-%H%M%S").mp4 -g "$(slurp)"
GNU gdb (GDB) 8.3.1
Copyright (C) 2019 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
[2019-12-02T05:40:33Z INFO engsim] This is engsim v0.1.0 (built from cbb3c327)
[2019-12-02T05:40:33Z INFO engsim] Order senders can now connect on port 3347
[2019-12-02T05:40:34Z INFO simulation::queue] Added a feed starting at 2018-07-01 23:00:00 UTC
[2019-12-02T05:40:34Z INFO engsim] ---- Controller handshake ----
[2019-12-02T05:40:34Z INFO engsim] No controller; skipping handshake
[2019-12-02T05:40:34Z INFO engsim] ---- Fast-forward phase ----
[2019-12-02T05:40:34Z INFO simulation::queue] Fast-forwarding to 2018-07-02 00:00:00 UTC
[2019-12-02T05:40:37Z INFO simulation::queue] Fast-forward complete (skipped 35739 messages)
[2019-12-02T05:40:37Z INFO engsim] FF complete; broadcasting summary quotes
[2019-12-02T05:40:37Z INFO epimetheus] Started HTTP thread
#!/bin/sh
# requires git lua lua-cjson lua-redis redis redis-cli
set -eo pipefail
REDIS_KEY=dictionary
test $(redis-cli exists $REDIS_KEY) = 1 || {
curl -L static.kiani.io/WebstersEnglishDictionary.txt.gzip \
| gzip -d \
| tr -d $"\r" \
| awk '/^$/ { lastempty = 1; next } start == 1 { lastempty = 0; print "|" $0; start += 1; next } lastempty && /^([-_A-Z 0-9]+)(; *([-_A-Z 0-9]+))*$/{ print $0; start = 1; lastempty = 0; next }; start { lastempty = 0; print "|"$0 }' \
| lua -e '
local trie_maker = require 'trie'
local vim = vim
local api = vim.api
local alphabet = 'abcdefghijklmnopqrstuvwxyz'
local Trie = trie_maker('.0123456789'..alphabet..alphabet:upper())
-- local Trie = trie_maker('^.0123456789'..alphabet..alphabet:upper())
local M = {}