Skip to content

Instantly share code, notes, and snippets.

@Risto-Stevcev
Risto-Stevcev / build.sh
Created April 23, 2023 19:56
linuxdeploy AppImage example
linuxdeploy-x86_64.AppImage --appdir AppDir -e /bin/lowdown -d /home/risto/scripts/lowdown.desktop -i 256x256/lowdown.png -o appimage
@Risto-Stevcev
Risto-Stevcev / 31-my-font-aliases.conf
Created April 15, 2023 12:51
Font aliasing in linux (ie for Helvetica)
<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<!--
On void, see /etc/fonts/conf.d/30-metric-aliases.conf
Sets the google font Arimo for sans-serif, and adds an alias for Helvetica
-->
<fontconfig>
<alias>
<family>sans-serif</family>
<prefer><family>Arimo</family></prefer>
@Risto-Stevcev
Risto-Stevcev / tcl-eval.md
Last active April 9, 2023 12:36
Tcl evaluation of "", [], and {} notation

Tcl evaluation of "", [], and {} notation

  • "" in tcl is like javascript ""
  • {} in tcl is like javascript ``
  • [] in tcl is like shell ``
@Risto-Stevcev
Risto-Stevcev / gnuplot.tcl
Created April 7, 2023 14:19
Gnu plot with Tcl
package require Tk
eval [exec gnuplot << "
set term tk
set key fixed left top vertical Right noreverse enhanced autotitle box lt black linewidth 1.000 dashtype solid
set samples 50, 50
set title \"Simple Plots\"
set title font \",14\" textcolor lt 1 norotate
set xrange \[ * : * \] noreverse writeback
set x2range \[ * : * \] noreverse writeback
set yrange \[ * : * \] noreverse writeback
@Risto-Stevcev
Risto-Stevcev / coffee.pl
Created April 7, 2023 14:16
Amount of coffee for french press
:- use_module(library(clpq)).
%% Amount of coffee to use for french press
coffee(CoffeeGrams, WaterOz) :-
{25 / 6 =:= CoffeeGrams / WaterOz}.
@Risto-Stevcev
Risto-Stevcev / client.js
Created April 7, 2023 13:56
Websockets using unix domain sockets
var ws = require('ws');
var client = new ws("ws+unix:///tmp/server.sock")
client.send('hello')
@Risto-Stevcev
Risto-Stevcev / inner-module.js
Created April 5, 2023 00:54
Inner modules in javascript
// Using let and a block statement allows you to create Ocaml-like inner modules
let Foo
{
// This is in a closure, but the module itself is declarative -- it's not a class
let norf = 567
// You can nest inner modules too
let Bar
{
let exclaim = '!'
@Risto-Stevcev
Risto-Stevcev / manipulate_terms.prolog
Last active September 22, 2022 20:18
Some notes on manipulating terms
?- TermStart = (X = 123), with_output_to(string(S), write_term(TermStart, [variable_names(['X'=X])])),
concat(S, ".", S2), open_string(S2, Stream), read_term(Stream, TermEnd, [variable_names(['X'=X])]).
TermStart = TermEnd, TermEnd = (X=123),
S = "X=123",
S2 = 'X=123.',
Stream = <stream>(0x55858662ae00).
?- use_module(library(optparse)).
true.
?- ExampleOptsSpec =
[ [opt(mode ), type(atom), default('SCAN'),
shortflags([m]), longflags(['mode'] ),
help([ 'data gathering mode, one of'
, ' SCAN: do this'
, ' READ: do that'
, ' MAKE: fabricate some numbers'
@Risto-Stevcev
Risto-Stevcev / range.pl
Created May 31, 2022 11:30
Prolog ranges
?- use_module(library(clpfd)).
?- I in 1..5, findall(I, indomain(I), Is).
Is = [1, 2, 3, 4, 5],
I in 1..5.