This file contains hidden or 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 CredCache | |
def initialize(filename) | |
@data = File.binread(filename) | |
@position = 0 | |
@magic_version = nil | |
end |
This file contains hidden or 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
fd = rb_sysopen_internal(&data); | |
if (fd < 0) { | |
if (errno == EMFILE || errno == ENFILE) { | |
rb_gc(); | |
fd = rb_sysopen_internal(&data); |
This file contains hidden or 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
fd = rb_sysopen_internal(&data); | |
if (fd < 0) { | |
if (errno == EMFILE || errno == ENFILE) { | |
rb_gc(); | |
fd = rb_sysopen_internal(&data); |
This file contains hidden or 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 -00 | |
my @ponies = <DATA>; | |
print $ponies[rand $#ponies]; | |
__END__ | |
_|\ _/|_, | |
,((\\``-\\\\_ | |
,(()) `))\ | |
,(())) ,_ \ |
This file contains hidden or 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/ruby -00 | |
puts DATA.readlines.sample | |
__END__ | |
_|\ _/|_, | |
,((\\``-\\\\_ | |
,(()) `))\ | |
,(())) ,_ \ | |
((())' | \ |
This file contains hidden or 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 fun(thing, option: true, other_option: false) | |
method(__method__).parameters.select {|e| e.first == :key}.map {|e| instance_variable_set "@"+e.last.to_s, binding.local_variable_get(e.last)} | |
puts "now you have ivar @option: #{@option} and @other_option: #{@other_option}" | |
end | |
fun(5, option: 6, other_option: 7) | |
##### now you have ivar @option: 6 and @other_option: 7 |
This file contains hidden or 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
$ grep "2016-01-04,7" bart.jan.4.monday.2016.csv |perl -F, -anwle'print $F[4]," ", $_'|sort -rn | |
466 2016-01-04,7,DALY,MONT,466 | |
441 2016-01-04,7,PHIL,MONT,441 | |
433 2016-01-04,7,WCRK,EMBR,433 | |
424 2016-01-04,7,PHIL,EMBR,424 | |
420 2016-01-04,7,BALB,MONT,420 | |
370 2016-01-04,7,DUBL,EMBR,370 | |
358 2016-01-04,7,WCRK,MONT,358 | |
337 2016-01-04,7,DUBL,MONT,337 | |
321 2016-01-04,7,DALY,EMBR,321 |
This file contains hidden or 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 'ffi' | |
class IO | |
extend FFI::Library | |
ffi_lib 'c' | |
attach_function 'dup2', [:int, :int], :int | |
end | |
IO.dup2(3, 4) |
This file contains hidden or 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
[8] pry(main)> dir.class | |
=> Pathname | |
[9] pry(main)> dir.chown "root", "root" | |
TypeError: no implicit conversion of String into Integer | |
from (pry):9:in `chown' |
This file contains hidden or 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
@_=map{open$_{$_},q q>q,$_?$+:eval lc join$,,sort qw/_[$_] FI E A;\ D @_ | |
NED$/}$|..$=;$_="OYPY_H\030c",@==grep{vec($/,$,++,2**3^0)=$=^ord$_}/( .) # (. ) | |
/sixgoos,!!1;eval$/,! @=for@_{sort{$b<=>$a}%_}; ## | |
print "Hello world!"; use 5.008; # # | |
warn "Just another Perl hacker,\n" if defined undef; ####### |