Skip to content

Instantly share code, notes, and snippets.

View ivuorinen's full-sized avatar

Ismo Vuorinen ivuorinen

View GitHub Profile
@ivuorinen
ivuorinen / robots.txt
Created April 15, 2013 09:18
Koko sivuston poistaminen Googlen ja muiden hakukoneiden listauksista
User-agent: *
Disallow: /
@ivuorinen
ivuorinen / mkvsubs.sh
Created January 30, 2015 07:31
MKV Subtitle extraction
#!/bin/bash
# Ismo Vuorinen <ismo@ivuorinen.net>, 2014
SCRIPTNAME=`basename $0`
# If no directory is given, work in local dir
if [ "$1" = "" ]; then
DIR="."
else
DIR="$1"
@ivuorinen
ivuorinen / entities.php
Created September 20, 2015 07:56
psr2-fixed, docblocked and 80-char width safe version
<?php
/**
* makeSafeEntities()
*
* Convert str to UTF-8 (if not already), then convert that to HTML named
* entities and numbered references.
* Compare to native htmlentities() function. Unlike that function,
* this will skip any already existing entities in the string.
*
* - mb_convert_encoding() doesn't encode ampersands, so use
@ivuorinen
ivuorinen / keybase.md
Created June 15, 2016 06:14
Keybase proof

Keybase proof

I hereby claim:

  • I am ivuorinen on github.
  • I am ivuorinen (https://keybase.io/ivuorinen) on keybase.
  • I have a public key whose fingerprint is 2ACD 5CFD 6298 A83B 16D9 DBCD 7D19 3B92 F274 2794

To claim this, I am signing this object:

@ivuorinen
ivuorinen / sleep.js
Created September 7, 2017 09:13
sleep.js
/**
* sleep(1000).then(function () { console.log('zzZZzzZZ...'); });
*
* @author gsamaras <https://stackoverflow.com/a/951057/594940>
* @param {Integer} ms
* @returns {Promise}
*/
window.sleep = function sleep(ms) {
return (
new Promise(function (resolve, reject) {
@ivuorinen
ivuorinen / laravel-homestead-xdebug.sh
Last active August 2, 2019 09:36
Enable xdebug for all PHP versions available on Laravel Homestead
#!/usr/bin/env bash
# Laravel Homestead
# Enable xdebug on all PHP versions (cli)
# Best place for this is in the user-customizations.sh in the Homestead folder
PHPV=$(ls /etc/php/)
for i in ${PHPV[@]}; do
if [ ! -f /etc/php/$i/cli/conf.d/20-xdebug.ini ]; then
sudo ln -s /etc/php/$i/mods-available/xdebug.ini /etc/php/$i/cli/conf.d/20-xdebug.ini
fi
@ivuorinen
ivuorinen / heartRain.html
Created January 30, 2018 22:06
heartRain.html
<!DOCTYPE html>
<html>
<head>
<title>heartrain</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
if(!image_urls) {
var image_urls = Array()
}
if(!flash_urls) {
# Remove files from your specified path.
git filter-branch --force --index-filter 'git rm --cached -r --ignore-unmatch dir/with/large/files/*' --prune-empty --tag-name-filter cat -- --all
rm -rf .git/refs/original/ && git reflog expire --expire=now --all && git gc --prune=now && git gc --aggressive --prune=now
@ivuorinen
ivuorinen / swapper.sh
Created January 2, 2019 13:17
swapfile automation
#!/bin/bash
# Swapfile generator
#
# Copyright 2019 Ismo Vuorinen <ismo@ivuorinen.net>
# Licensed under MIT <https://opensource.org/licenses/MIT>
_err () {
echo "(!) Error: $1" >&2; exit 1
}
@ivuorinen
ivuorinen / docker_clean.sh
Created January 8, 2019 14:40
Docker cleanup
#!/bin/sh
for image in $(/usr/bin/docker images -q -f dangling=true);
do
/usr/bin/docker rmi $image;
done
for volume in $(/usr/bin/docker volume ls -qf dangling=true);
do
/usr/bin/docker volume rm $volume;