This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
# Usage: upgrade-cpan.pl 5.14.0 | sort -u | cpanm | |
use strict; | |
use File::Find::Rule; | |
use JSON; | |
my $old = shift; | |
my @files = File::Find::Rule->file->name('install.json')->in("$ENV{HOME}/perl5/perlbrew/perls/perl-$old/lib/site_perl/$old"); | |
for my $file (@files) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Open 10k concurrent WebSocket connections with the client and server running | |
# in the same process and perform 10k WebSocket message roundtrips | |
# | |
# Tested on OS X 10.9.2 (MacBook Air) with Perl 5.18.2 and EV 4.17 (kqueue) | |
# | |
# 560.9MB memory usage, 0% CPU usage once roundtrips are finished after 36s | |
# (with all 20k sockets still open) | |
# | |
# Get the latest version of Mojolicious from http://github.com/kraih/mojo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Add an "CMS internal link" option to the Link plugin. | |
* | |
* This was adapted from a similar plugin for Drupal (version 7.x-2.3): | |
* Written by Henri MEDOT <henri.medot[AT]absyx[DOT]fr> | |
* http://www.absyx.fr | |
* https://drupal.org/project/ckeditor_link | |
* | |
* Portions of code: | |
* Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Watches the folder or files passed as arguments to the script and when it | |
# detects a change it automatically refreshes the current selected Chrome tab or | |
# window. | |
# | |
# http://razius.com/articles/auto-refreshing-google-chrome-on-file-changes/ | |
# | |
# Usage: | |
# ./chrome-refresh.sh /folder/to/watch /some/folder/file_to_watch.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
# Usage: | |
# cpanm Mojolicious Mojo::Redis | |
# ./mojo-websocket-pubapp.pl daemon | |
use Mojolicious::Lite; | |
use Mojo::Redis; | |
websocket '/' => sub { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use v5.10; | |
use strict; | |
use warnings; | |
use Mojolicious::Lite; | |
# Explicit use as a helper for PAR |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# For greatest convenience | |
alias dc='docker-compose' | |
# Clean up unused containers and images | |
alias dclean='docker rm $(docker ps -qf "status=exited")' | |
alias dclean_images='docker rmi $(docker images -qf "dangling=true")' | |
# Assume dockerized $nginx and $mysql containers... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
cat > /etc/network/interfaces.d/eth0-0.cfg <<EOF | |
auto eth0:0 | |
allow-hotplug eth0:0 | |
iface eth0:0 inet static | |
address 178.32.XXX.XXX | |
netmask 255.255.255.255 | |
broadcast 178.32.XXX.XXX | |
post-up /sbin/ip route replace default via $(/sbin/ip route | awk '/default/ { print $3 }') dev eth0 src 178.32.XXX.XXX |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker network create -d overlay skynet | |
docker service create --name rethink-master --network skynet -p 8080:8080 rethinkdb rethinkdb --bind all | |
docker service create --name rethink-slave --mode global --mount type=bind,source=/var/lib/rethinkdb,target=/data --network skynet rethinkdb rethinkdb --bind all -j rethink-master |
OlderNewer