Skip to content

Instantly share code, notes, and snippets.

@sharifulin
sharifulin / Formating digital
Created November 10, 2009 17:50
Simple Perl code of formating digital
#!/usr/bin/perl
use common::sense;
sub D($) {
for (scalar reverse shift) {
s/(\d{3})(?=\d)/$1 /g;
return scalar reverse;
}
}
@sharifulin
sharifulin / gist:562053
Created September 2, 2010 08:34
Get mp3-url from podcast
#!/usr/bin/env perl
use common::sense;
use ojo;
die "Usage: $0 <podcast url>" unless @ARGV;
b(g( shift )->dom->find("enclosure[url]")->each(sub {
local $_ = shift->attrs->{url};
say if /\.mp3$/;
}));
@sharifulin
sharifulin / gist:658382
Created November 1, 2010 15:41
Uploadify and Mojolicious app
#!/usr/bin/env perl
BEGIN { $ENV{MOJO_MAX_MESSAGE_SIZE} = 50 * 1024 * 1024; }
use Mojolicious::Lite;
my $conf = { path => 'data/uploads/', ext => qr/\.(?i:mp3|wav|wma|ogg)$/ };
post '/uploadify/check' => sub {
my $self = shift;
my $param = $self->req->params->to_hash;
@spicycode
spicycode / tmux.conf
Created September 20, 2011 16:43
The best and greatest tmux.conf ever
# 0 is too far from ` ;)
set -g base-index 1
# Automatically set window title
set-window-option -g automatic-rename on
set-option -g set-titles on
#set -g default-terminal screen-256color
set -g status-keys vi
set -g history-limit 10000
@diegok
diegok / mojo_ua_gzip.pl
Created October 10, 2011 01:09
Mojo::UserAgent with gzip support
#!/usr/bin/env perl
use 5.12.0;
use Mojo::UserAgent;
use Compress::Zlib;
my $ua = Mojo::UserAgent->new;
$ua->on( start => sub {
my ( $ua, $tx ) = @_;
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active May 1, 2024 03:34
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@kevin-smets
kevin-smets / iterm2-solarized.md
Last active May 1, 2024 13:56
iTerm2 + Oh My Zsh + Solarized color scheme + Source Code Pro Powerline + Font Awesome + [Powerlevel10k] - (macOS)

Default

Default

Powerlevel10k

Powerlevel10k

#!/bin/bash
#
# Copyright (c) 2015, Intel Corporation
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
@Bouke
Bouke / gist:11261620
Last active August 3, 2023 01:46
Multiple Python installations on OS X

Previous versions used homebrew to install the various versions. As suggested in the comments, it's better to use pyenv instead. If you are looking for the previous version of this document, see the revision history.

$ brew update
$ brew install pyenv
$ pyenv install 3.5.0
$ pyenv install 3.4.3
$ pyenv install 3.3.6
$ pyenv install 3.2.6
$ pyenv install 2.7.10

$ pyenv install 2.6.9

@tristanfisher
tristanfisher / Ansible-Vault how-to.md
Last active April 3, 2024 13:55
A short tutorial on how to use Vault in your Ansible workflow. Ansible-vault allows you to more safely store sensitive information in a source code repository or on disk.

Working with ansible-vault


I've been using a lot of Ansible lately and while almost everything has been great, finding a clean way to implement ansible-vault wasn't immediately apparent.

What I decided on was the following: put your secret information into a vars file, reference that vars file from your task, and encrypt the whole vars file using ansible-vault encrypt.

Let's use an example: You're writing an Ansible role and want to encrypt the spoiler for the movie Aliens.