Skip to content

Instantly share code, notes, and snippets.

@tbutts
tbutts / tmux-migrate-options.py
Last active February 29, 2024 08:11
For tmux configs: Merge deprecated/removed -fg, -bg, and -attr options into the -style option
#!/usr/bin/env python
# vim: set fileencoding=utf-8
#
# USAGE:
# Back up your tmux old config, run the script and redirect stdout to your conf
# file. Example:
#
# $ cp ~/.tmux.conf ~/.tmux.conf.orig
# $ python ./tmux-migrate-options.py ~/.tmux.conf.orig > ~/.tmux.conf
#
@shawa
shawa / facts.pl
Last active November 20, 2017 23:10
An Exposition of Facts
:- use_module(library(clpfd)). % grab some matrix functions
% Herein we present facts about boards.
% Given these facts, the user can consult Prolog for interesting
% inferences based on these facts.
% Example consultation:
%
% › swipl facts.pl
% Welcome to SWI-Prolog (threaded, 64 bits, version 7.6.1)
@jamescmartinez
jamescmartinez / slack_delete.rb
Last active January 4, 2021 21:28
This Ruby script will bulk remove all Slack files older than 30 days. Just add your API token from https://api.slack.com/web#authentication into the token quotes at the top of the file.
require 'net/http'
require 'json'
require 'uri'
@token = ''
def list_files
ts_to = (Time.now - 30 * 24 * 60 * 60).to_i # 30 days ago
params = {
token: @token,
@Kukunin
Kukunin / onresourceloaded.js
Created June 30, 2014 19:44
PhantomJS module to implement robust onLoadFinished callback, supporting redirects, JS resource loading etc
function addAllResourcesLoadedCallback(page, timeout) {
function debug(text) {
if (typeof page.onDebug == "function") {
page.onDebug(text);
}
}
var counter = [], timer;
timeout = timeout || 2000;