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
class Hash | |
def to_proc | |
method(:[]).to_proc | |
end | |
def dig(*keys) | |
result = fetch(keys.shift, nil) | |
if result.is_a?(Hash) && keys.any? | |
result.dig *keys |
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
class Array | |
def ^(operand) | |
(self | operand) - (self & operand) | |
end | |
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
diff --git a/server.c b/server.c | |
index db172e3..a16e2eb 100644 | |
--- a/server.c | |
+++ b/server.c | |
@@ -4,6 +4,7 @@ | |
#include <string.h> | |
#include <syslog.h> | |
#include <sys/time.h> | |
+#include <time.h> | |
#include <unistd.h> |
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
@ECHO OFF | |
SETLOCAL EnableExtensions | |
SET PROCESS=%~nx1 | |
SET NAME=%~n1 | |
FOR /F %%x IN ('tasklist /NH /FI "IMAGENAME eq %PROCESS%"') DO IF %%x == %PROCESS% GOTO FOUND | |
ECHO OS^|Windows^|Process^|%NAME%^|Status 0 2 %NAME% (%PROCESS%) is not running. | |
GOTO EOF | |
:FOUND | |
ECHO OS^|Windows^|Process^|%NAME%^|Status 1 0 %NAME% (%PROCESS%) is running. | |
:EOF |
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 'optparse' | |
user_input = {} | |
OptionParser.new do |opts| | |
opts.banner = "RFE #{RFE::VERSION}" | |
opts.separator "" | |
opts.separator "Available Options:" | |
opts.on("-h", "--help", "help") do |some_option| | |
puts opts | |
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
class Field | |
Bit = Struct.new(:to_s, :to_i, :to_bool, :regex) do | |
alias to_str to_s | |
def ===(other) entries.any? { |entry| entry === other } end | |
end | |
False = Bit.new(?0, 0, false, /^[0nf]/i) | |
True = Bit.new(?1, 1, true, /^[1yt]/i) |
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
String.fromCharCode(this._=Math.pow(!0x0+!0<<0|0>>0,this._0=-~-~-~-~-~-0)*((+!0+'00')-~0),+!0+'00'-_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
class ShiftRightZeroFill | |
def >(operand) | |
(@value & 0xFFFFFFFF) >> operand | |
end | |
def initialize(value) | |
@value = value | |
end | |
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
#!/usr/bin/env ruby | |
class RubyArchive | |
require 'rubygems/package' | |
require 'zlib' | |
attr_reader :path | |
class Archive |
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 ChutesAndLadders | |
class Game | |
# chutes ladders | |
Board = {16 => 6, 1 => 23, | |
48 => 26, 4 => 14, | |
49 => 11, 9 => 31, | |
56 => 53, 21 => 42, | |
62 => 19, 28 => 84, |
NewerOlder