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 | |
# Wrapper for docker command, which extends that with more commands: | |
# - docker rm all : removes all containers | |
# - docker rmi all : removes all images | |
# - docker stop all : stops all containers | |
# - docker clean : stops and removes all containers and images | |
def remove_all_containers | |
ids = `docker ps -a -q`.each_line.map {|line| line.chomp}.join(' ') |
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 'date' | |
current_date = DateTime.now | |
year = current_date.year | |
month = current_date.month | |
day = current_date.day | |
leap_year = Date.leap?(year) | |
def message | |
puts "Happy International Programmers' Day :)" |
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 java.time.LocalDate; | |
public class ProgrammersDay { | |
private static void message() { | |
System.out.println("Happy International Programmers' Day :)"); | |
} | |
public static void main(String[] args) { | |
LocalDate date = LocalDate.now(); |
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 'open3' | |
require 'colorize' | |
Open3.popen3(ARGV[0]) do |stdin, stdout, stderr, wait_thr| | |
while line = stdout.gets | |
if line.start_with?('WARN') | |
print line.colorize(:yellow) | |
elsif line.start_with?('ERROR') |
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 | |
DEFAULT_GERRIT_PORT = '29418' | |
if ENV['GERRIT_USER'] && ENV['GERRIT_HOST'] | |
gerrit_uri = "#{ENV['GERRIT_USER']}@#{ENV['GERRIT_HOST']}" | |
gerrit_port = ENV['GERRIT_PORT'].nil? ? DEFAULT_GERRIT_PORT : ENV['GERRIT_PORT'] | |
# %1$s and %2$s etc. denotes the command line arguments | |
supported_commands = { |
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
<!DOCTYPE html><html><title>B4K</title><canvas id="c" width="448" height="384"></canvas><script>function D(t){var x,o=t.split("|"),e=o.shift();for(x=o[N];x--;)e=e.replace(RegExp(o[x].charAt(0),"g"),o[x].substring(1));return e}function g(t,x,o,e){for(e=o[N];e--;)o[e]=t.charCodeAt(x*o[N]+e)-Z}function l(x,o){for(0>v?v=49:v>49&&(v=0),m=0,h=0,f=!1,g(L,v,t),x=W;x--;)for(o=H;o--;)4==t[W*o+x]&&(t[W*o+x]=1,u.x=x,u.y=o)}function p(x,o,e){for(x=3;x--;){for(o=W;o--;)for(e=H;e--;)q?2!=x||t[W*e+o]>2?1==x&&t[W*e+o]>2?w[M](z[8],o*Z+4,e*Z+4):0==x&&t[W*e+o]>2&&w[M](z[t[W*e+o]],o*Z,e*Z):w[M](z[t[W*e+o]],o*Z,e*Z):w[M](z[0],o*Z,e*Z);1==x&&q?w[M](z[7],u.x*Z+4,u.y*Z+4):0==x&&q&&w[M](z[4],u.x*Z,u.y*Z)}if(w.font="bold 14px sans-serif",w[S]="rgba(255,255,255,.4)",w.textAlign="center",q)f&&w[F](E[0],C,19),w[F](E[11]+(v+1)+E[10]+E[12]+m+E[10]+E[13]+h,C,376);else{for(x=1;x<E[N]-5;x++)w[F](E[x],C,19*x+106);w[F](E[9],C,376)}}function B(x,o,e,r,n,y){for(w=O.c[X]("2d"),z=Array(P[N]),o=Array(256),x=z[N];x--;){for(g(I,P[x][3],o),e=document.cr |
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 'openssl' | |
require 'digest/sha2' | |
content = "Super secret content." | |
sha256 = Digest::SHA2.new(256) | |
aes = OpenSSL::Cipher.new("AES-256-CBC") | |
iv = rand.to_s | |
key = sha256.digest("secret123") |
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 | |
# Creates m3u playlists and sfv compatible checksum list | |
# from list of music files in the current directory. | |
require 'zlib' | |
entries = Dir.glob('*.{mp3,ogg,m4a,flac}').sort | |
if entries.size > 0 then |
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 | |
# encoding: UTF-8 | |
list = `busybox.exe --list` | |
list.split("\n").each do |command| | |
file = File.new("#{command.strip}.bat", "w:UTF-8") | |
file.puts("@echo off") | |
file.puts("busybox.exe #{command} %*") | |
file.close | |
end |
NewerOlder