Skip to content

Instantly share code, notes, and snippets.

View cjk's full-sized avatar
💭
I may be slow to respond.

Claus Klingberg cjk

💭
I may be slow to respond.
View GitHub Profile
@khalidx
khalidx / node-typescript-esm.md
Last active April 22, 2024 15:40
A Node + TypeScript + ts-node + ESM experience that works.

The experience of using Node.JS with TypeScript, ts-node, and ESM is horrible.

There are countless guides of how to integrate them, but none of them seem to work.

Here's what worked for me.

Just add the following files and run npm run dev. You'll be good to go!

package.json

@sebastiancarlos
sebastiancarlos / tari.bash
Last active August 23, 2023 11:51
tari - tar "in-place" - Remove duplicates when operating on tar archives
# All my gist code is licensed under the terms of the MIT license.
# Video demo: https://www.youtube.com/watch?v=IyzNz1uPEGg
# deleteAllButMostRecentInTar
# source: https://stackoverflow.com/a/71666950/21567639
function deleteAllButMostRecentInTar()
{
local archive=$1
local filesToDelete=$(mktemp)
@Azeirah
Azeirah / setup-gitlab-for-magit-in-doom-emacs.md
Last active November 23, 2023 07:07
Setting up magit forge for gitlab in Doom Emacs

Magit forge for Gitlab in Doom Emacs

This guide assumes you're working on a Unix-like environment. I'm using Linux Mint (Ubuntu). It should work on Macs, and might on Windows.

These are the four steps you can use as a checklist, see the headings below for the details on each step.

  • Enable forge support
  • Create a Gitlab API key
  • Add your gitlab credentials to ~/.authinfo.gpg
  • Set-up forge in emacs
@bzerangue
bzerangue / json-to-ndjson.md
Last active January 31, 2024 20:57
JSON to NDJSON

NDJSON is a convenient format for storing or streaming structured data that may be processed one record at a time.

  • Each line is a valid JSON value
  • Line separator is ‘\n’

1. Convert JSON to NDJSON?

cat test.json | jq -c '.[]' > testNDJSON.json
@c02y
c02y / emm
Last active April 26, 2019 11:32
emm function for bash
#!/bin/bash
# 0. put this script into ~/.local/bin/
# 1. Create a emacsclient.desktop in ~/.local/share/applications/emacsclient.desktop
# 1.1 if you installed Emacs using pkg manager instead of anaconda3, omit this step
# 1.2 if you are using non-GUI or launcher is unnecessary, omit this step including the next
# 1.3 if you are using an OS without systemctl installed, omit this step including the next
#
# emacsclient.desktop:
#
@max-mapper
max-mapper / upload.sh
Created March 27, 2019 00:43
upload large file to zenodo from command line (curl)
# in zenodo ui create a deposition. get the id
curl -H "Accept: application/json" -H "Authorization: Bearer $TOKEN" "https://www.zenodo.org/api/deposit/depositions/$DEPOSITION"
# get the bucket id from above
curl --progress-bar -o /dev/null --upload-file ./$FILE https://www.zenodo.org/api/files/$BUCKET/$FILE?access_token=$TOKEN
@magicdude4eva
magicdude4eva / zsh-syntax-highlighting paste performance improvement
Last active April 19, 2024 14:03
zsh-syntax-highlighting paste performance improvement
Add the following in .zshrc:
...
plugins=(osx git zsh-autosuggestions zsh-syntax-highlighting zsh-nvm docker kubectl)
...
### Fix slowness of pastes with zsh-syntax-highlighting.zsh
pasteinit() {
OLD_SELF_INSERT=${${(s.:.)widgets[self-insert]}[2,3]}
zle -N self-insert url-quote-magic # I wonder if you'd need `.url-quote-magic`?
@meskarune
meskarune / cal.lua
Last active February 11, 2024 18:57
conky calendar and weather
#!/usr/bin/env lua
conky_color = "${color1}%2d${color}"
t = os.date('*t', os.time())
year, month, currentday = t.year, t.month, t.day
daystart = os.date("*t",os.time{year=year,month=month,day=01}).wday
month_name = os.date("%B")
@mt7479
mt7479 / CorrectRecoveryPartitionSize.ps1
Last active April 27, 2024 22:27
Resize the recovery partition on Windows 10 Systems to save some space
<#
Correct the default UEFI partition layout created by ConfigMgr to save some disk space.
https://docs.microsoft.com/de-de/windows-hardware/manufacture/desktop/configure-uefigpt-based-hard-drive-partitions
## Notes:
* The recovery partition size for Windows 10 1703 needs to be at least 900 MB or the partition will ignored.
* Windows 10 1511 Winre.wim size: 313.009.179 Bytes
* Windows 10 1607 Winre.wim size: 324.995.101 Bytes
;; -------------------------------------------------------------------------------------------------------------------------
;; Neo tree open xdg on point helpers
;; -------------------------------------------------------------------------------------------------------------------------
(defun neotree-open-xdg-on-point ()
"Open a file under point."
(interactive)
(call-process "xdg-open" nil 0 nil
(neo-buffer--get-filename-current-line)))
;; Add "o" as the key that will launch the function