Skip to content

Instantly share code, notes, and snippets.

View componhead's full-sized avatar

emiliano componhead

  • firenze
View GitHub Profile
@componhead
componhead / osx-for-hackers.sh
Created October 21, 2015 07:42 — forked from matthewmueller/osx-for-hackers.sh
OSX for Hackers (Mavericks/Yosemite)
# OSX for Hackers (Mavericks/Yosemite)
#
# Source: https://gist.github.com/brandonb927/3195465
#!/bin/sh
# Some things taken from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Ask for the administrator password upfront
@componhead
componhead / wsl-notes.txt
Last active December 4, 2017 16:10
WSL (WIndows Subsystem Linux) notes
UNINSTALL
- Open a privileged cmd.exe
- lxrun /uninstall /full
- reboot
- sc stop lxssmanager
- rmdir /S %LOCALAPPDATA%\lxss
- uninstall from "Microsoft Store" (this deletes all your installation):
- from the store "add to Start menu"
- from the start menu right-click "uninstall"
@componhead
componhead / prompt.fish
Created November 24, 2017 10:35 — forked from joshhunt/prompt.fish
Fish Shell Git Prompt
# Git prompt, heavily modified from the g2 fish prompt. https://github.com/orefalo/g2/tree/master/fish
#
# Inspired from bobthefish is a Powerline-style, Git-aware fish theme optimized for awesome.
#
# You will probably need a Powerline-patched font for this to work:
#
# https://powerline.readthedocs.org/en/latest/fontpatching.html
# https://github.com/Lokaltog/powerline-fonts
set -g current_bg NONE
@componhead
componhead / Tree.hs
Created February 19, 2019 18:21 — forked from Kedrigern/Tree.hs
Implementation of binary search tree in Haskell
{- Implementation of BST (binary search tree)
Script is absolutly free/libre, but with no guarantee.
Author: Ondrej Profant -}
import qualified Data.List
{- DEF data structure -}
data (Ord a, Eq a) => Tree a = Nil | Node (Tree a) a (Tree a)
deriving Show
@componhead
componhead / curl.md
Created May 6, 2019 09:04 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@componhead
componhead / rm_mysql.md
Created July 31, 2019 09:42 — forked from vitorbritto/rm_mysql.md
Remove MySQL completely from Mac OSX

Remove MySQL completely

  1. Open the Terminal

  2. Use mysqldump to backup your databases

  3. Check for MySQL processes with: ps -ax | grep mysql

  4. Stop and kill any MySQL processes

  5. Analyze MySQL on HomeBrew:

brew remove mysql

@componhead
componhead / random.md
Created December 31, 2020 14:55 — forked from joepie91/random.md
Secure random values (in Node.js)

Not all random values are created equal - for security-related code, you need a specific kind of random value.

A summary of this article, if you don't want to read the entire thing:

  • Don't use Math.random(). There are extremely few cases where Math.random() is the right answer. Don't use it, unless you've read this entire article, and determined that it's necessary for your case.
  • Don't use crypto.getRandomBytes directly. While it's a CSPRNG, it's easy to bias the result when 'transforming' it, such that the output becomes more predictable.
  • If you want to generate random tokens or API keys: Use uuid, specifically the uuid.v4() method. Avoid node-uuid - it's not the same package, and doesn't produce reliably secure random values.
  • If you want to generate random numbers in a range: Use random-number-csprng.

You should seriously consider reading the entire article, though - it's

@componhead
componhead / gist:aed27d01ce7dfec93d016f0c5fee9e70
Created January 29, 2021 08:29 — forked from RRethy/gist:ad8a9a3b1112a48226ec3336fa981224
Seamlessly editing remote files in (Neo)Vim with Netrw and scp

Seamlessly editing remote files in (Neo)Vim with Netrw and scp

Neovim and Vim both come bundled with a standard plugin called Netrw. Netrw acts a file explorer (similar to NERDTree), but more importantly has the ability to work with scp (as well as sftp, rcp, ftp, and lots of others :h netrw-nread) to let you edit files and browse directories that are hosted on a remote machine, inside of your local Vim instance.

This is useful since you are able to use your Vim setup and plugins without copying over your dotfiles to the remote machine. As well, since the file is copied to your local machine, there will be no delay when typing.

Setup

This is optional for Vim, but required for Neovim (check this Neovim issue explaining why).

@componhead
componhead / actor.js
Created March 23, 2021 10:43 — forked from CrowdHailer/actor.js
Implementing actors in JavaScript.
// Turns out this was not too difficult.
// By using the event loop as a global mail box ordering is even guaranteed for messages between only two actors.
// TODO would like to try and put one actor in a web worker to get some real parallism
// TODO would like to handle errors and have the concept of a deceased actor while a reference to an actor still exists. Probably involves creating an actor system like in Scala. Eurgh.
var actor = {
send: function(message) {
var self = this;
console.log("sending to:", self);
setTimeout(function(){
@componhead
componhead / signing-git-commits.md
Created July 10, 2025 06:55 — forked from phortuin/signing-git-commits.md
Set up a GPG key for signing Git commits on MacOS (M1)

Based on this blogpost.

To sign Git commits, you need a gpg key. GPG stands for GNU Privacy Guard and is the de facto implementation of the OpenPGP message format. PGP stands for ‘Pretty Good Privacy’ and is a standard to sign and encrypt messages.

Setting up

Install with Homebrew:

$ brew install gpg