Skip to content

Instantly share code, notes, and snippets.

@brayan2
brayan2 / Cmd color
Created June 21, 2015 08:38
C Code that changes the cmd color
/*
Copyright (C) 2013 by Sammy Brian Gathuita .
This program is a free software written by Sammy Brian Gathuita for
educational and research purposes only. Therefore, this program comes
without any warranty. Anyone may distribute this program WITHOUT changing
the source code and copyright.
Contact person: BRIAN, e-mail at bgathuita@gmail.com
*/
@dhh
dhh / linux-setup.sh
Last active May 19, 2024 04:59
linux-setup.sh
# CLI
sudo apt update -y
sudo apt install -y \
git curl btop \
docker.io docker-buildx \
build-essential pkg-config autoconf bison rustc cargo clang \
libssl-dev libreadline-dev zlib1g-dev libyaml-dev libreadline-dev libncurses5-dev libffi-dev libgdbm-dev libjemalloc2 \
libvips imagemagick libmagickwand-dev mupdf mupdf-tools \
redis-tools sqlite3 libsqlite3-0 libmysqlclient-dev \
rbenv apache2-utils
@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.