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 images -aq | xargs docker rmi |
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 | |
use 5.008; | |
use warnings FATAL => 'all'; | |
use strict; | |
# Highlight by reversing foreground and background. You could do | |
# other things like bold or underline if you prefer. | |
my @OLD_HIGHLIGHT = ( | |
color_config('color.diff-highlight.oldnormal'), |
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
# original: https://github.com/gitlabhq/gitlabhq/blob/7-10-stable/lib/tasks/gitlab/backup.rake | |
require 'active_record/fixtures' | |
namespace :gitlab do | |
namespace :backup_without_pack do | |
# Create backup of GitLab system | |
desc "GITLAB | Create a backup of the GitLab system" | |
task create: :environment do | |
warn_user_is_not_gitlab |
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
Array.prototype.findBy = function(attributes:Object):Array { | |
return VectorUtil.of(this).findBy(attributes); | |
}; | |
Array.prototype.setPropertyIsEnumerable("findBy", false); | |
Array.prototype.getOneBy = function(attributes:Object):Array { | |
return VectorUtil.of(this).getOneBy(attributes); | |
}; | |
Array.prototype.setPropertyIsEnumerable("getOneBy", false); |
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
# Based on http://stackoverflow.com/questions/6853744/how-can-i-have-rspec-test-for-my-default-scope/6853925#6853925 | |
# | |
# ### Example | |
# | |
# class User < ActiveRecord::Base | |
# scope :recent, -> { order(created_at: :desc).limit(10) } | |
# end | |
# | |
# describe User do | |
# it { is_expected.to scope(:recent) { order(created_at: :desc).limit(10) } } |
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
find $* -type f | ([ -x "`which sha1sum 2> /dev/null`" ] && xargs sha1sum || xargs shasum) | awk '{ p[$1] = p[$1] ? p[$1] " = " $2 : $2 } END { for (key in p) { if (p[key] ~ / = /) print p[key] } }' |
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
suid: restart_jenkins | |
sudo chown root restart_jenkins | |
sudo chmod u+s restart_jenkins | |
restart_jenkins: restart_jenkins.c | |
cc restart_jenkins.c -o restart_jenkins |
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
# ---------------------------------------------------------------------- | |
# | |
# I think Java style interface is unreadable in Ruby. | |
# Because must methods and normal methods are mixed. | |
# | |
# Ruby で Java の interface のような実装をすると、 | |
# 普通のメソッドと実装必須なメソッドが混ざってわかりにくい。 | |
# | |
class Car | |
def engine |
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
Category.roots.map do |root| | |
tree = [] | |
root.class.each_with_level(root.self_and_descendants) do |category, level| | |
tree << "#{' ' * level}#{category.name}" | |
end | |
tree | |
end.join("\n").display |
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 | |
# requirements: kldload speaker | |
echo 'CDE ~ CDE ~ GEDCDED ~ CDE ~ CDE ~ GEDCDEC ~ GGEGAAG ~ EEDDL2C' > /dev/speaker |
NewerOlder