Skip to content

Instantly share code, notes, and snippets.

@diego3g
diego3g / settings.json
Last active May 19, 2024 04:56
VSCode Settings (Updated)
{
"workbench.startupEditor": "newUntitledFile",
"editor.fontSize": 14,
"editor.lineHeight": 1.8,
"javascript.suggest.autoImports": true,
"javascript.updateImportsOnFileMove.enabled": "always",
"editor.rulers": [80, 120],
"extensions.ignoreRecommendations": true,
"typescript.tsserver.log": "off",
"files.associations": {
@simonw
simonw / recover_source_code.md
Last active May 19, 2024 04:54
How to recover lost Python source code if it's still resident in-memory

How to recover lost Python source code if it's still resident in-memory

I screwed up using git ("git checkout --" on the wrong file) and managed to delete the code I had just written... but it was still running in a process in a docker container. Here's how I got it back, using https://pypi.python.org/pypi/pyrasite/ and https://pypi.python.org/pypi/uncompyle6

Attach a shell to the docker container

Install GDB (needed by pyrasite)

apt-get update && apt-get install gdb
@mohanpedala
mohanpedala / bash_strict_mode.md
Last active May 19, 2024 04:52
set -e, -u, -o, -x pipefail explanation
@leemartin
leemartin / spotify-waveform.js
Last active May 19, 2024 04:46
Spotify Waveform Data Generation from Audio Analysis API
const fs = require('fs')
const data = require('./track.json')
let duration = data.track.duration
let segments = data.segments.map(segment => {
return {
start: segment.start / duration,
duration: segment.duration / duration,
loudness: 1 - (Math.min(Math.max(segment.loudness_max, -35), 0) / -35)
@spalladino
spalladino / mysql-docker.sh
Created December 22, 2015 13:47
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@plembo
plembo / pandocdocx2md.md
Last active May 19, 2024 04:54
Convert docx to markdown with pandoc

Convert Word documents to markdown with pandoc

I use pandoc to convert masses of Word documents to markdown. Still working on a generic script, but for now here's the "gist" of what I type into the terminal:

$ myfilename="example"
$ pandoc \
-t markdown_strict \
--extract-media='./attachments/$myfilename' \
$myfilename.docx \
@lmorchard
lmorchard / substack-to-opml.js
Last active May 19, 2024 04:28
Substack to OPML export
// To use this script:
//
// 1. Copy this whole gist
// 2. Log into your account on substack.com
// 3. On a substack.com page, open the JavaScript console in your browser's web dev tools
// 4. Paste this into the console and hit return.
// 5. You should see substack-publications.opml has been downloaded.
//
// If you'd like to grab this code and improve it or turn it into a better tool, go right ahead!
// Maybe drop me a toot at @lmorchard@hackers.town or @lmorchard@toot.lmorchard.com if you liked it.
@jskherman
jskherman / admonition.lua
Last active May 19, 2024 04:26
A Pandoc Lua filter to convert Callout Blocks to Hugo admonitions (shortcode).
-- Pandoc Lua-filter for Obsidian Callouts
-- Original Source: https://forum.obsidian.md/t/rendering-callouts-similarly-in-pandoc/40020/
-- Notes:
-- Original snippet modified to output Hugo {{< admonition >}} shortcodes with collapse.
-- Make sure to have a blank line before and after the `> [!note]` line of the callout block.
-- The filter works recursively so if you want callouts within callouts, make sure to leave a blank line
-- before and after the `> [!note] Your title here` line of each callout.
-- Usage:
@iuliandita
iuliandita / alacritty.toml
Last active May 19, 2024 04:26
Alacritty TOML config file, with all defaults present (commented out), in the proper order. Color scheme is Catpuccin Mocha.
# alacritty.toml
# commented lines are the defaults
# man 5 alacritty (>0.13) for full config manual
#import = [
#"~/.config/alacritty/catpuccin-mocha.toml",
#"~/.config/alacritty/keybindings.toml",
#]
[shell]