Skip to content

Instantly share code, notes, and snippets.

Code Terminology Kind Usage Line
$scr scripting additions folder Property of class: domain System Events : Disk-Folder-File Suite 1
%doc music folder Property of class: user domain object System Events : Disk-Folder-File Suite 2
µdoc music folder Enumeration Standard Additions : File Commands 3
ƒhlp help Enumeration Standard Additions : File Commands 4
ƒhlp help folder Enumeration Standard Additions : File Commands 5
ƒlib shared libraries Enumeration Standard Additions : File Commands 6
ƒlib shared libraries folder Enumeration Standard Additions : File Commands 7
ƒmod modem scripts Enumeration Standard Additions : File Commands 8
ƒmod modem scripts folder Enumeration Standard Additions : File Commands 9
@AlexanderPavlenko
AlexanderPavlenko / vr_blur.py
Created December 21, 2017 14:11
GIMP filter
#!/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)
@AlexanderPavlenko
AlexanderPavlenko / bip32_rescue.md
Last active April 22, 2023 11:58
bit32_rescue #bitcoin

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
# 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!
### 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 October 22, 2013 12:32
replace static links to less methods
([^-])url\(.*?/img/([^'")]+).*?\)
$1image-url('$2')
@AlexanderPavlenko
AlexanderPavlenko / gist:6078702
Created July 25, 2013 11:00
values_at vs. map
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 July 25, 2013 10:02
JRuby's Enumerator#to_enum rebinds instance variables to another context?
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
require 'timeout'
Timeout.timeout(0.5) do
begin
sleep 1
rescue Exception => ex
puts ex.inspect
puts 'ಠ_ಠ'
end
end
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
}