Skip to content

Instantly share code, notes, and snippets.

@jdmonty
jdmonty / git-setup.sh
Created November 22, 2023 16:17 — forked from rdundon/git-setup.sh
Git and Node with Zscaler proxy
#!/bin/sh
# Git proxy settings
echo "Configuring Git for compatibility with ZScaler..."
git config --global http.proxy http://gateway.zscaler.net:80/
git config --system http.proxy http://gateway.zscaler.net:80/
@jdmonty
jdmonty / idb-backup-and-restore.md
Created July 5, 2023 10:07 — forked from loilo/idb-backup-and-restore.js
Back up and restore an IndexedDB database

Back up and restore an IndexedDB database

This gist is an ES module which provides functions to import and export data from an IndexedDB database as JSON. It's based on Justin Emery's indexeddb-export-import package, but applies some adjustments that reflect better on the current browser landscape (i.e. better developer ergonomics but no support for Internet Explorer).

Usage

For each of the provided functionalities, you need a connected IDBDatabase instance.

Export Data

import { idb } from 'some-database'
@jdmonty
jdmonty / rust-command-line-utilities.markdown
Created December 3, 2022 10:04 — forked from sts10/rust-command-line-utilities.markdown
A curated list of command-line utilities written in Rust

A curated list of command-line utilities written in Rust

Note that I have not tried all of these personally, and cannot and do not vouch for all of the tools listed here. In most cases, the descriptions here are copied directly from their code repos. Some may have been abandoned. Investigate before installing/using.

The ones I use regularly include: bat, dust, exa, fd, hyperfine, miniserve, ripgrep, just, zoxide and cargo-wipe.

  • atuin: "Magical shell history"
  • bandwhich: Terminal bandwidth utilization tool
  • bat: A replacement for cat that provides syntax highlighting and other features.
  • bottom: Yet another cross-platform graphical process/system monitor.
@jdmonty
jdmonty / Quirks of C.md
Created November 20, 2022 22:34 — forked from fay59/Quirks of C.md
Quirks of C

Here's a list of mildly interesting things about the C language that I learned mostly by consuming Clang's ASTs. Although surprises are getting sparser, I might continue to update this document over time.

There are many more mildly interesting features of C++, but the language is literally known for being weird, whereas C is usually considered smaller and simpler, so this is (almost) only about C.

1. Combined type and variable/field declaration, inside a struct scope [https://godbolt.org/g/Rh94Go]

struct foo {
   struct bar {
 int x;
@jdmonty
jdmonty / summers.hs
Created October 4, 2022 19:12 — forked from LFY/summers.hs
Partial implementation of LISP program synthesis
-- Analytic inductive programming, according to survey paper:
-- Kitzelmann, Emanuel. Inductive Programming: A Survey of Program Synthesis Techniques
-- Other related work:
-- D.R. Smith. The synthesis of LISP programs from examples: A survey.
-- P.D. Summers. A Methodology for LISP program construction from examples.
-- Author: Lingfeng Yang
@jdmonty
jdmonty / unit.sh
Created October 4, 2022 11:53 — forked from ptc-mrucci/unit.sh
Bash test: get the directory of a script
#!/bin/bash
tmp=$(python -c "import os, sys; print(os.path.realpath('/tmp'))")
function test {
MESSAGE=$1
RECEIVED=$2
EXPECTED=$3
if [ "$RECEIVED" = "$EXPECTED" ]; then
@jdmonty
jdmonty / expecting.md
Created September 8, 2022 00:35 — forked from ksafranski/expecting.md
Basic principles of using tcl-expect scripts

Intro

TCL-Expect scripts are an amazingly easy way to script out laborious tasks in the shell when you need to be interactive with the console. Think of them as a "macro" or way to programmaticly step through a process you would run by hand. They are similar to shell scripts but utilize the .tcl extension and a different #! call.

Setup Your Script

The first step, similar to writing a bash script, is to tell the script what it's executing under. For expect we use the following:

#!/usr/bin/expect
@jdmonty
jdmonty / Blah.jq
Created August 12, 2022 20:28 — forked from turbo/Blah.jq
[$github, $bitbucket]
| (flatten) as $all_projects
| ([$all_projects[] | select(.stats.languages != null).stats.languages | to_entries] | flatten) as $langstats
| (
[
$all_projects[]
| select(.stats.languages != null).stats.languages
| keys
]
| flatten
@jdmonty
jdmonty / ffmpeg-wrapper
Created March 2, 2022 19:13 — forked from BenjaminPoncet/ffmpeg-wrapper
Synology VideoStation ffmpeg wrapper with DTS, EAC3 and TrueHD support (Installation instructions in 1st comment)
#!/bin/bash
rev="12"
_log(){
echo "$(date '+%Y-%m-%d %H:%M:%S') - ${streamid} - $1" >> /tmp/ffmpeg.log
}
_log_para(){
echo "$1" | fold -w 120 | sed "s/^.*$/$(date '+%Y-%m-%d %H:%M:%S') - ${streamid} - = &/" >> /tmp/ffmpeg.log
@jdmonty
jdmonty / nginx.conf
Created February 17, 2018 04:56 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048