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 'java' | |
url = Java::JavaNet::URL.new("file:///usr/share/sounds/alsa/Front_Center.wav") | |
clip = Java::JavaApplet::Applet.newAudioClip(url) | |
clip.play | |
sleep 3 |
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
def fetch_ftp | |
ftp = Net::FTP.new(self.meta[:host]) | |
ftp.login(user = self.username, passwd = self.password) | |
buffer = "" | |
ftp.getbinaryfile(self.url) { |data| buffer << data } | |
ftp.quit() | |
MultiXml.parse(buffer) rescue nil |
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
# grub-mkimage -d /usr/lib/grub/x86_64-efi -O x86_64-efi -p /grub -o /boot/EFI/boot/bootx64.efi part_gpt fat normal boot configfile | |
set color_normal=white/black | |
set color_highlight=black/white | |
set menu_color_normal=blue/black | |
set menu_color_highlight=black/blue | |
set timeout=1 | |
insmod efi_gop | |
set default=0 |
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
BEGIN { | |
require "fileutils" | |
FileUtils.touch("run.old") | |
$stdout = $stderr = open("run","w") | |
} | |
END { | |
system("diff -u run.old run") | |
FileUtils.mv("run", "run.old", :force => true) | |
} |
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
def printgrid(table) | |
strings = table.map do |row| | |
row.map { |cell| cell.to_s } | |
end | |
column_widths = [] | |
strings.each do |row| | |
row.each_with_index do |cell,i| | |
column_widths[i] = [column_widths[i] || 1, cell.length + 2].max | |
end |
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
[ 0.000000] Initializing cgroup subsys cpuset | |
[ 0.000000] Initializing cgroup subsys cpu | |
[ 0.000000] Linux version 3.1.0-0-zen (nobody@) (gcc version 4.6.1 20110819 (prerelease) (GCC) ) #1 ZEN SMP PREEMPT Fri Oct 28 17:10:45 CEST 2011 | |
[ 0.000000] Command line: BOOT_IMAGE=/vmlinuz-linux-zen ro threadirqs quiet pcie_aspm=force root=/dev/disk/by-label/shine-root resume=/dev/disk/by-label/shine-swap init=/bin/systemd | |
[ 0.000000] Disabled fast string operations | |
[ 0.000000] BIOS-provided physical RAM map: | |
[ 0.000000] BIOS-e820: 0000000000000000 - 0000000000058000 (usable) | |
[ 0.000000] BIOS-e820: 0000000000058000 - 0000000000059000 (ACPI NVS) | |
[ 0.000000] BIOS-e820: 0000000000059000 - 00000000000a0000 (usable) | |
[ 0.000000] BIOS-e820: 0000000000100000 - 0000000020000000 (usable) |
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
#define _GNU_SOURCE | |
#include <stdlib.h> | |
#include <unistd.h> | |
#include <stdio.h> | |
#include <pty.h> | |
#include <sys/select.h> | |
static void copy(int from, int to) { | |
char buf[4096]; | |
ssize_t size; |
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 MultiBlock | |
class NoBlockError < StandardError; end | |
class Catcher < BasicObject | |
def initialize(&blk) | |
@self = blk.binding.eval "self" | |
@blocks = {} | |
@mode = :catch | |
instance_eval &blk |
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
# Need to block | |
begin | |
json = Timeout.timeout 3 do | |
Net::HTTP.new(uri.host, uri.port).start do |https| | |
https.request_get(uri.request_uri) | |
end | |
end | |
rescue Timeout::Error | |
if @retries >= 3 | |
return {return: 'Gateway Timeout.', response: 504} |
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
Rubinius Crash Report #rbxcrashreport | |
[[Exception]] | |
A toplevel exception occurred | |
Thread has been interrupted (Interrupt) | |
Backtrace: | |
{ } in Rubinius::Loader#signals at kernel/loader.rb:126 | |
Signal.run_handler at kernel/common/signal.rb:68 | |
Rubinius.received_signal at kernel/delta/rubinius.rb:240 |