Skip to content

Instantly share code, notes, and snippets.

@rafamdr
rafamdr / babylisp.py
Created October 14, 2020 18:56
BabyLisp
# Given a basic Lisp-like string expression, parse it (where the available functions are add, subtract, multiply,
# and divide, and they all take in 2 values).
#
# Examples:
# $ babyLisp(‘(add 1 2)’)
# $ 3
# $ babyLisp(‘(multiply 4 (add 2 3))’) $ 20
# ----------------------------------------------------------------------------------------------------------------------
@rafamdr
rafamdr / redirecting_using_socat.txt
Created July 11, 2020 18:19
Redirect local service with specific port using a public port
# Two examples (TCP and UDP) showing how to redirect traffic to private ports (6120, 6121) used by a local service,
# using public ports (8000, 8001).
# Bonus: if your application/service has IP address or DNS name filtering, in this case, using this approach,
# it will understand that all requests are coming from "localhost"
socat tcp-listen:8001,reuseaddr,fork tcp:localhost:6121
socat udp-listen:8000,reuseaddr,fork udp:localhost:6120
@rafamdr
rafamdr / curl_progressbar.txt
Last active April 12, 2021 11:14
curl with progress bar
curl --progress-bar \
-o sending_output.txt \
[email protected] \
https://sitetest.io/upload
# If you want a progress meter for HTTP POST or PUT requests, you need to redirect the response output to a file,
# using shell redirect (>), -o [file] or similar.
# Source: https://stackoverflow.com/questions/9973056/curl-how-to-display-progress-information-while-uploading#answer-39302427:~:text=I%20had%20trouble%20with%20the%20accepted%20answer's%20command%20redirection%20and%20found
/*
* 3D Geohash modified from https://github.com/kungfoo/geohash-java/blob/master/src/main/java/ch/hsr/geohash/GeoHash.java
* Paul Brebner, Instaclustr.com
* 5 June 2019
* Just a demonstration of how altitude can be used to encode a 3D geohash, for use with Anomalia Machina blog series.
*/
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
@astamicu
astamicu / Remove videos from Youtube Watch Later playlist.md
Last active September 10, 2025 04:06
Script to remove all videos from Youtube Watch Later playlist

UPDATED 22.11.2022

It's been two years since the last update, so here's the updated working script as per the comments below.

Thanks to BryanHaley for this.

setInterval(function () {
    video = document.getElementsByTagName('ytd-playlist-video-renderer')[0];

 video.querySelector('#primary button[aria-label="Action menu"]').click();
@baskaran-md
baskaran-md / nginx.conf
Created September 2, 2014 20:20
NginX allow POST on static pages.
# ...
server {
listen 80;
server_name localhost;
location / {
root html;
index index.html index.htm;
}
@VolMi
VolMi / meld-diff.nemo_action
Last active June 29, 2025 14:03
Nemo action "Compare with meld"
[Nemo Action]
Active=true
Name=Compare with Meld
Name[cz]=Srovnání s meld
Name[de]=Mit meld vergleichen
Name[fr]=Comparer avec meld
Name[nl]=Vergelijk met meld
Comment=Show differences between files or directories
Comment[cz]=Ukázat rozdíly mezi souborama a složky