Skip to content

Instantly share code, notes, and snippets.

View cben's full-sized avatar

Beni Cherniavsky-Paskin cben

View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@cben
cben / dodgetocat_v2.png
Last active April 1, 2023 13:16 — forked from alienlebarge/dodgetocat_v2.png
Is there an easy way to link image in a GIST ?
dodgetocat_v2.png
beni@beni580 ~> tclsh
% set n 42
42
% tcl::unsupported::representation $n
value is a pure string with a refcount of 4, object pointer at 0x5604d811de00, string representation "42"
% expr {$n + 1}
43
% tcl::unsupported::representation $n
value is a int with a refcount of 4, object pointer at 0x5604d811de00, internal representation 0x2a:(nil), string representation "42"
%
@cben
cben / fragments-from-init.el
Created October 1, 2017 09:12
emacs more CUA
;; use on top of cua-mode.
;; Extreme CUA - kill buffers with C-w like browser tabs.
;; I still have motor memory for cutting with C-w :-(, hopefully this will help.
(defun kill-buffer-unless-selection ()
(interactive)
(if (region-active-p)
(progn
(beep)
(message "Use C-x for cutting, lest you kill the buffer you're working on."))
@cben
cben / 00-MEMORY-USAGE-List.md
Last active December 7, 2020 10:34
High memory usage during ListAndWatch -> List

Point-free style is the default in "concatenative" programming languages like FORTH and PostScript. And, since they use postfix order, with function argument coming before the function, simulating "let" should be easy, right?

Funnily, there are no named-arg lambdas in most of these languages*. Not even the modern Factor (supports named arguments for named functions, but not in anonymous "quotations"). But FORTH and PostScript do have ways to simulate local variables. So we can show the equivalence the other way around: implement "let", then implement "lambda" in terms of "let" 😁.

FROM fedora:31
MAINTAINER sd-mp-devel@redhat.com
# TODO: how to use prebuilt rubygem-nokogiri? Compiling it is heavy and brittle.
# That's what tools/hack_bundle.rb tries to achieve, but still compiles it.
# Fedora's rubygem-bundler is patched (as opposed to upstream `gem install bundler`)
# but no luck, both compile it. See also https://github.com/rubygems/bundler/issues/1964
RUN dnf install -y ruby ruby-devel rubygem-bundler rubygem-nokogiri gcc-c++ make redhat-rpm-config git dnf-plugins-core
RUN dnf builddep -y rubygem-nokogiri
@cben
cben / selenium_.json
Created March 17, 2020 08:38
https://github.com/cben/mathdown/issues/193 - examples of current saucelabs supported browsers json
{
"list": [
{
"name": "Desktop",
"list": [
{
"name": "PC",
"list": [
{
"name": "Operating System",
@cben
cben / CF-CNAME-flattened-TTL.md
Created September 10, 2015 20:46
The problem with CloudFlare's DNS "CNAME flattening" TTL

[attaching this to a CloudFlare survey why I left them (for DNSimple)]

I was a free user using CloudFlare only for DNS, chiefly because it can simulate CNAME at an apex domain. The apex domains mathdown.net,mathdown.com point to mathdown-cben.rhcloud.com. Cloudflare "CNAME-flattening" nicely returns an A record; unfortunately it's served with a huge TTL of 7 days(!), which causes a long outage when the underlying IP changes.

I asked support how I can lower the TTL (BTW it's great that you provide free support at all) and was told [https://support.cloudflare.com/hc/en-us/requests/522551, emphasis mine]:

This is based on the TTL of your authoritative provider for mathdown-cben.rhcloud.com: