Skip to content

Instantly share code, notes, and snippets.

View allomov's full-sized avatar

Aliaksandr Lomau allomov

View GitHub Profile
irb(main):004:0> x = RubyVM::InstructionSequence.new('puts "hello #{foo}"')
=> <RubyVM::InstructionSequence:<compiled>@<compiled>>
irb(main):005:0> puts x.disasm
== disasm: <RubyVM::InstructionSequence:<compiled>@<compiled>>==========
0000 trace 1 ( 1)
0002 putself
0003 putobject "hello "
0005 putself
0006 opt_send_simple <callinfo!mid:foo, argc:0, FCALL|VCALL|ARGS_SKIP>
0008 tostring
@allomov
allomov / cf-openstack.yml
Last active December 24, 2015 16:29
create_secure_groups_openstack
name: lomov-cf
releases:
- name: cf
version: 176
director_uuid: ab3dec87-3877-4169-97bc-5c62c765fe46
@allomov
allomov / update-org-quota-in-cf-by-name.sh
Last active February 9, 2016 16:05
Just for case you need to update organization in CF by names. (to get quota list use `cf quotas` command). This solution is described here http://docs.pivotal.io/pivotalcf/opsguide/change-quota-plan.html.
org_name=my-org
quota_name=runaway
org_guid=$(CF_TRACE=true cf org $org_name | grep -B7 $org_name | grep guid | awk '{gsub(/\"guid\":|\ |\"|\,/,"")}1')
quota_guid=$(cf curl /v2/quota_definitions -X 'GET' | grep -B7 runaway | grep guid | awk '{gsub(/\"guid\":|\ |\"|\,/,"")}1')
cf curl /v2/organizations/$org_guid -X 'PUT' -d "{\"quota_definition_guid\":\"$quota_guid\"}"
@voelzmo
voelzmo / release_copy.rb
Last active September 4, 2018 11:07
bosh release copy script
#!/usr/bin/env ruby
require "cli"
require "cli/release"
require "cli/blob_manager"
require "blobstore_client"
require "cli/versions/versions_index"
require 'optparse'
@joerayme
joerayme / LICENSE
Created July 5, 2013 13:33
Very simple Graphite widget for Dashing
Copyright (c) 2013 Couller Ltd. and Joseph Ray
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
@dwallraff
dwallraff / create_cert.sh
Last active September 26, 2019 17:27
Commands to create a self-signed SSL cert or CSRs using the openssl conf from https://gist.github.com/dwallraff/c1ed31291ac7cf19304b
##### Commands to generate SSL certs/artifcts
# Download the temp.cnf file using the wget command below
# Edit temp.cnf and add your information
# Run the uncommented out commands to generate a self-signed cert (cert.pem) and private key (keyfile.pem)
wget https://gist.githubusercontent.com/dwallraff/c1ed31291ac7cf19304b/raw/e06feacbb85ac63659e6c1c40c70d5481522b390/temp.cnf
# Generate a new keyfile. A 2048 bit key size is TOTALLY fine. Jack it up to 4096 and wait if you must...
openssl genrsa -out keyfile.key 2048
@j0sh
j0sh / Makefile
Created March 31, 2011 07:05
iOS static library cross-compile script.
# iOS builds for ARMv7 and simulator i386.
# Assumes any dependencies are in a local folder called libs and
# headers in a local folder called headers.
# Dependencies should already have been compiled for the target arch.
PROJ=untitled
ifeq ($(IOS), 1)
ARCH=armv7
DEVICE=OS
CC_FLAGS=-arch $(ARCH)
@joelmoss
joelmoss / gist:2470666
Created April 23, 2012 12:37
Capistrano recipe for Puma start/stop/restarts
set :shared_children, shared_children << 'tmp/sockets'
namespace :deploy do
desc "Start the application"
task :start, :roles => :app, :except => { :no_release => true } do
run "cd #{current_path} && RAILS_ENV=#{stage} bundle exec puma -b 'unix://#{shared_path}/sockets/puma.sock' -S #{shared_path}/sockets/puma.state --control 'unix://#{shared_path}/sockets/pumactl.sock' >> #{shared_path}/log/puma-#{stage}.log 2>&1 &", :pty => false
end
desc "Stop the application"
task :stop, :roles => :app, :except => { :no_release => true } do
@thijsc
thijsc / gist:1391107
Created November 24, 2011 11:08
Select item from chosen js select with Capybara and Selenium
def select_from_chosen(item_text, options)
field = find_field(options[:from])
option_value = page.evaluate_script("$(\"##{field[:id]} option:contains('#{item_text}')\").val()")
page.execute_script("$('##{field[:id]}').val('#{option_value}')")
end
@somebody32
somebody32 / gist:5232120
Last active October 4, 2022 08:19
Список литературы для ознакомления с concurrent programming и реализацией этих принципов и подходов на ruby. Огромное спасибо @brainopia за составление.

Введение

Начать стоит отсюда. Не пугайтесь то, что это книга по незнакомой OS, эти термины практически везде одинаковые и здесь они изложены в понятной для начинающих форме.

http://www.qnx.com/developers/docs/6.4.1/neutrino/getting_started/s1_procs.html

Прочесть нужно треть главы до подраздела "Starting a process", если С не пугает, читайте полностью. После прочтения вы будете понимать, что такое process, thread, mutex, priorites, semaphores, scheduler, contex-switch, kernel states.

Ruby