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
module Serverspec | |
module Type | |
class Partition < Base | |
def initialize(partition, type) | |
@name = partition | |
@partition_table = {} | |
case type | |
when 'cylinder' | |
options = "-l" |
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 | |
export HOME="/home/me" | |
export PATH="$HOME/.plenv/bin:$PATH" | |
eval "$(plenv init -)" | |
cd $HOME/app | |
exec carton exec -- "$1" |
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
#!perl | |
use strict; | |
use warnings; | |
use Furl; | |
use Imager; | |
use Text::AAlib qw(:all); | |
my $url = 'https://2.gravatar.com/avatar/0e2fa4d5e82a2addb50f03414870ea46?d=https%3A%2F%2Fidenticons.github.com%2F76d9ed40d8b87622cbfa7bc12cffbcdb.png&s=420'; | |
my $ua = Furl->new; |
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 | |
_RSS=0 | |
_SHARED=0 | |
_PID=$1 | |
_SMAPS=`cat /proc/$_PID/smaps` | |
for i in `echo "$_SMAPS" | grep 'Rss' | awk '{print $2}'`; do | |
_RSS=`expr $_RSS + $i` | |
done |
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 Mojolicious::Lite; | |
use File::Basename; | |
use Plack::Builder; | |
use HTML::TreeBuilder::XPath; | |
use DBI; | |
get '/' => sub { | |
my $self = shift; |
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 | |
set -x | |
uuid=$(uuidgen) | |
docker build -t myapp . | |
docker run -d --name mysql-${uuid} --env MYSQL_ROOT_PASSWORD=xxxxxx mysql:5.6 | |
docker run -d --name memcached-${uuid} memcached |
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
# ・8-18文字であること | |
# ・大文字小文字アルファベットと数字が含まれていること | |
# ・.@_- (ドット、アットマーク、アンダースコア、ハイフン)のうち少なくとも1 | |
# つ含まれていること | |
class PasswordGeneratorAttributeError < StandardError; end | |
class PasswordGenerator | |
NUMBERS = [*0..9] | |
UPPER_CHARS = [*'A'..'Z'] | |
LOWER_CHARS = [*'a'..'z'] |
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
(unless (>= 24 emacs-major-version) | |
(error "requires Emacs 24 or later.")) | |
(deftheme heroku "A color theme inspired by Heroku's old dashboard") | |
(custom-theme-set-variables | |
'heroku | |
'(linum-format "%4d\u2502 ")) | |
(let ((*background* "#1b1b24") |
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
require 'sidekiq/api' | |
namespace :sidekiq do | |
task 'stop' do | |
ps = Sidekiq::ProcessSet.new | |
abort 'Sidekiq process not running' if ps.count == 0 | |
ps.first.quiet! | |
puts "SIGUSR1 sent\nWaiting 10sec for status update" |
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
# lib/activity_logger.rb | |
class ActivityLogger < Logger | |
def format_message(severity, timestamp, progname, msg) | |
base_log = { | |
timestamp: timestamp, | |
severity: severity | |
} | |
base_log.merge(msg).to_json + "\n" | |
end | |
end |
NewerOlder