Skip to content

Instantly share code, notes, and snippets.

Avatar
☺️

Mike Arvela mieky

☺️
View GitHub Profile
@mieky
mieky / .dir_colors
Last active Feb 27, 2021
macOS LS_COLORS for web development
View .dir_colors
# LS_COLORS
# Maintainers: Magnus Woldrich <m@japh.se>,
# Ryan Delaney <ryan.patrick.delaney@protonmail.com>
# URL: https://github.com/trapd00r/LS_COLORS
#
# This is a collection of extension:color mappings, suitable to use as your
# LS_COLORS environment variable. Most of them use the extended color map,
# described in the ECMA-48 document; in other words, you'll need a terminal
# with capabilities of displaying 256 colors.
#
View pseudo-uuid.js
// Generate a deterministic pseudo UUID (v4), such that the same input always gives the same output.
// Potentially useful for test mocks or such where a specific datum is associated to a specific UUIDs,
// but doesn't need guarantees against clashing.
// With ES6 modules, you can remove the "require" part, and instead import like this:
// import { createHash } from "crypto";
const pseudoUuid = (input) => require("crypto")
.createHash("sha256")
.update(input)
@mieky
mieky / rabbit_publish.sh
Last active Jan 8, 2021
Publishing a JSON payload into a local RabbitMQ HTTP API
View rabbit_publish.sh
#!/bin/bash
# Publish JSON payloads into a RabbitMQ HTTP API with curl and jq.
# Usage: rabbit_publish.sh exchange_name '{ "data": "my json payload" }'
#
# To install prequisites on macOS:
# brew install rabbitmq jq
# rabbitmq-plugins enable rabbitmq_management
if [ $# -ne 2 ]; then
@mieky
mieky / macos-lifehacks.md
Last active Oct 27, 2020
MacOS Lifehacks
View macos-lifehacks.md

Collection of useful tips & tricks to set up on a Mac.

Safari: bind cmd+alt+arrows to switch between previous/next tab

defaults write -app Safari NSUserKeyEquivalents '{
"Show Next Tab" = "@~\\U2192";
"Show Previous Tab" = "@~\\U2190";
}'
View fetch-luuppi-events.js
// npm install --save axios cheerio
const axios = require('axios');
const cheerio = require('cheerio');
const fetchEvents = () => {
return axios.get('https://www.luuppi.fi')
.then((response) => {
const $ = cheerio.load(response.data);
return $(".tapahtuma_otsikko a")
View looby-bot-1.js
const TelegramBot = require('node-telegram-bot-api');
const token = 'token-goes-here';
const bot = new TelegramBot(token, { polling: true });
bot.onText(/\/hai/, (message) => {
bot.sendMessage(message.chat.id, 'hello looby');
});
console.log('I am putting myself to the fullest possible use, which is all I think that any conscious entity can ever hope to do.');
@mieky
mieky / README.md
Created Jan 8, 2017
Mike's terminal
View README.md
@mieky
mieky / HOWTO.md
Last active Jul 26, 2016
notify-on-completion for Vagrant
View HOWTO.md

Alex Kotliarskyi wrote a great little script to show OS X desktop notifications when a long-running terminal command finishes (and is not in focus).

Making it work with a Vagrant virtual machine turned out to be straightforward. These instructions assume zsh as shell, bash might work similarly.

  1. Following Alex's instructions, install the notifyme script on OS X, in e.g. ~/bin/notifyme (assuming ~/bin is in $PATH, remember to chmod u+x notifyme)
  2. (Vagrant) Install Ruby on the VM: sudo apt-get install ruby
  3. (OS X) Install the vagrant-notify plugin: vagrant plugin install vagrant-notify
  4. (OS X) Restart the virtual machine: vagrant halt & vagrant up
  5. (OS X) Alias our script under a name which the plugin knows: ln -s ~/bin/notifyme ~/bin/notify-send
  6. (Vagrant) Append to the end of the ~/.zshrc in your Vagrant box:
@mieky
mieky / WTFBYABPL.txt
Last active Aug 29, 2015
DO WHAT THE FUCK YOU WANT TO + BUY YOURSELF A BEER PUBLIC LICENSE
View WTFBYABPL.txt
DO WHAT THE FUCK YOU WANT TO + BUY YOURSELF A BEER PUBLIC LICENSE
Version 1, Jan 2015
Copyright (C) 2015 Mike Arvela (@mieky)
DO WHAT THE FUCK YOU WANT TO + BUY YOURSELF A BEER PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.
@mieky
mieky / WTFGFBPPL.txt
Created Jan 24, 2015
DO WHAT THE FUCK YOU WANT TO + GLUTEN-FREE BEER/PIZZA PUBLIC LICENSE
View WTFGFBPPL.txt
DO WHAT THE FUCK YOU WANT TO + GLUTEN-FREE BEER/PIZZA PUBLIC LICENSE
Version 1, Feb 2013
Copyright (C) 2013 Mike Arvela
DO WHAT THE FUCK YOU WANT TO + GLUTEN-FREE BEER/PIZZA PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.