Skip to content

Instantly share code, notes, and snippets.

View mieky's full-sized avatar
🦀

Mike Arvela mieky

🦀
View GitHub Profile
@mieky
mieky / ununzip.sh
Created May 9, 2013 10:25
Un-unzip a file without a root folder that spews its contents all around the place.
#!/bin/bash
# A bash-wrapped version of http://www.commandlinefu.com/commands/view/9536/un-unzip-a-file
if [ $# -eq 0 ]; then
echo "Un-unzips a file without a root folder."
echo "Usage: ununzip <filename>"
exit 1
elif [ ! -e $1 ]; then
echo "File not found: $1"
exit 1
fi
@mieky
mieky / WTFGFBPPL.txt
Created January 24, 2015 08:47
DO WHAT THE FUCK YOU WANT TO + GLUTEN-FREE BEER/PIZZA PUBLIC LICENSE
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.
// 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")
@mieky
mieky / looby-bot-1.js
Created February 16, 2017 10:36 — forked from anttti/looby-bot-1.js
looby-bot-1
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 January 8, 2017 08:41
Mike's terminal
@mieky
mieky / HOWTO.md
Last active July 26, 2016 07:15
notify-on-completion for Vagrant

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 / gist:8646454
Created January 27, 2014 10:39
jvisualvm over ssh
on the remote (Ubuntu) machine:
/etc/default/tomcat7
->
JAVA_OPTS = "-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.port=1098"
sudo service tomcat7 restart
on the local machine:
@mieky
mieky / mokuplam.itermcolors
Last active December 21, 2015 19:08
iterm2 color scheme and matching themes for zsh + irssi
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Ansi 0 Color</key>
<dict>
<key>Blue Component</key>
<real>0.11764705926179886</real>
<key>Green Component</key>
<real>0.11372549086809158</real>
@mieky
mieky / isyyspakkauta.js
Last active December 20, 2015 21:28
Bookmarklet to conveniently browse Isyyspakkaus in-line with just the left/right arrow keys.
;(function($) {
var url = 'http://www.lily.fi/blogit/isyyspakkaus';
if (window.location.href !== url) {
window.location = url;
return;
}
var links = $(".blog-archive-list").find("a").get().reverse();
var currentIndex = parseInt(localStorage.getItem("currentIndex") || 0, 10);
@mieky
mieky / local_deploy.sh
Created December 19, 2012 10:45
A helper script for deploying a WAR file to a local Tomcat container (with Manager & JMX enabled in tomcat-users.xml for username/password)
#!/bin/bash
if [ "$#" -ne 1 ];
then
echo "This script deploys a WAR file to a local Tomcat container."
echo "Usage: $0 <war_file>"
exit 1
fi
WAR_FILE=$1