Skip to content

Instantly share code, notes, and snippets.

Alexander Pavlenko AlexanderPavlenko

  • Russia, Moscow
Block or report user

Report or block AlexanderPavlenko

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View vr_blur.py
#!/usr/bin/env python
from gimpfu import *
def vr_blur(image, layer):
# width = 3840
# height = 1.0*width*layer.height / layer.width
# layer = pdb.gimp_drawable_transform_scale(layer, 0, 0, width-1, height-1, TRANSFORM_FORWARD, INTERPOLATION_LANCZOS, 1, 3, TRANSFORM_RESIZE_ADJUST)
# layer.translate(0, 540 - layer.height/2)
# pdb.gimp_layer_flatten(layer)
View bip32_rescue.md

If you have received a payment to some address, which is not listed in your wallet, but was generated from your XPub — don't worry, it's not lost and can be recovered as follows:

  1. install Electrum (tested on version 2.7.12)
  2. in Electrum, restore wallet with the inaccessible funds from its BIP32 Passphrase (also called Seed, 13 words)
  3. in the restored wallet, switch to Console tab, paste getmasterprivate(), hit enter
  4. visit bip32.org
  5. select "Derive From: BIP32 Key"
  6. paste xprv… from Electrum Console into the "BIP32 Extended Key" field
  7. select "Derivation Path: Custom"
  8. paste m/0/n (or whatever is your gateway's address_derivation_scheme) into the "Custom Path" field, where n is the order's keychain_id
View .i3_config
# This file has been auto-generated by i3-config-wizard(1).
# It will not be overwritten, so edit it as you like.
#
# Should you change your keyboard layout somewhen, delete
# this file and re-run i3-config-wizard(1).
#
# i3 config file (v4)
#
# Please see http://i3wm.org/docs/userguide.html for a complete reference!
View gist:e15c78d5068884531417
### Keybase proof
I hereby claim:
* I am AlexanderPavlenko on github.
* I am alerticus (https://keybase.io/alerticus) on keybase.
* I have a public key whose fingerprint is 21A4 17B8 8937 82DE A577 052F BABE D11F BE87 3DB9
To claim this, I am signing this object:
@AlexanderPavlenko
AlexanderPavlenko / gist:7099831
Created Oct 22, 2013
replace static links to less methods
View gist:7099831
([^-])url\(.*?/img/([^'")]+).*?\)
$1image-url('$2')
View gist:6078702
require 'benchmark'
n = 1000
Benchmark.bm do |bm|
keys = (1..10000).to_a
hash = Hash[keys.zip(keys)]
bm.report do
n.times do
keys.map{|key| hash[key] }
@AlexanderPavlenko
AlexanderPavlenko / buggy_enumerator.rb
Created Jul 25, 2013
JRuby's Enumerator#to_enum rebinds instance variables to another context?
View buggy_enumerator.rb
class BuggyEnumerator < Enumerator
def initialize(that)
@ivar = that
end
def each
return to_enum(:each) unless block_given?
@ivar.each{|item| yield item }
end
end
View gist:5443488
require 'timeout'
Timeout.timeout(0.5) do
begin
sleep 1
rescue Exception => ex
puts ex.inspect
puts 'ಠ_ಠ'
end
end
View trace.rb
f = File.open('/tmp/tr', 'w')
set_trace_func proc {
|event, file, line, id, binding, classname|
if event == "call" or event == "return"
f.printf "%8s %s:%-2d %10s %8s\n", event, file, line, id, classname
end
}
You can’t perform that action at this time.