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 bash | |
echo '-----> update <-----' | |
apt update | |
echo '-----> upgrade <-----' | |
apt --yes upgrade | |
echo '-----> dist-upgrade <-----' | |
apt --yes dist-upgrade |
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 ruby | |
password_length = (ARGV[0] || 16).to_i | |
symbol_count = (ARGV[1] || 2).to_i | |
alphanumerics = ("a".."z").to_a + ("A".."Z").to_a + ("0".."9").to_a | |
symbols = "~`!@##$%^&-=_+()[]{};:,.".chars | |
50.times do | |
password = password_length.times.collect { alphanumerics[Random.rand(0...alphanumerics.length)] }.join | |
symbol_count.times { password[Random.rand(0...password.length)] = symbols[Random.rand(0...symbols.length)] } |
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
import datetime | |
import time | |
class µstamp(datetime.datetime): | |
def __init__(self, year, month, day, hour=0, minute=0, second=0, microsecond=0, tzinfo=None, *, fold=0): | |
super().__init__() | |
def __add__(self, other): | |
if type(other) is int: other = datetime.timedelta(days=other) |
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
function cpd { | |
if [ "$1" == "" ]; then printf `pwd` | pbcopy; return 0; fi | |
if [ -f "$1" ]; then printf `pwd`/$1 | pbcopy; return 0; fi | |
if [ ! -d "$1" ]; then echo "$1: No such directory"; return 1; fi | |
printf `pwd` | pbcopy | |
popd > /dev/null | |
} |
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 ruby | |
require "optparse" | |
require "uuidtools" | |
DEFAULT_COUNT = 20 | |
RANDOM_FUNC = -> { $options[:count].times { puts UUIDTools::UUID.random_create } } | |
$options = { | |
count: DEFAULT_COUNT, |
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
@startuml | |
autonumber | |
Alice -> Bob: Authentication Request | |
Bob --> Alice: Authentication Response | |
@enduml |
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
$ cd /opt/local/share/curl | |
$ sudo wget https://curl.haxx.se/ca/cacert.pem | |
$ sudo mv curl-ca-bundle.crt curl-ca-bundle.crt-original | |
$ sudo mv cacert.pem curl-ca-bundle.crt | |
$ rvm remove 2.4.0 | |
$ rvm install 2.4.0 # some time later... | |
$ rvm use 2.4.0 | |
$ ruby --version | |
ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-darwin14] | |
$ rvm gemset list |
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
$ rvm install 2.4.0 | |
Searching for binary rubies, this might take some time. | |
Found remote file https://rubies.travis-ci.org/osx/10.10/x86_64/ruby-2.4.0.tar.bz2 | |
Checking requirements for osx_port. | |
Certificates in '/opt/local/etc/openssl/cert.pem' are already up to date. | |
Requirements installation successful. | |
ruby-2.4.0 - #configure | |
ruby-2.4.0 - #download | |
ruby-2.4.0 - #validate archive | |
ruby-2.4.0 - #extract |
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 python | |
import os | |
import os.path | |
for item in os.listdir('.'): | |
if not os.path.isdir(item): continue | |
os.chdir(item) | |
try: | |
print 'Updating "%s"...' % item |
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
# Enhance rails.vim to work with test/factories/*_factory.rb | |
mkdir ~/.vim/macros && cat > ~/.vim/macros/rails.vim | |
:Rnavcommand factory test/factories spec/factories -glob=**/* -suffix=_factory.rb |
NewerOlder