Skip to content

Instantly share code, notes, and snippets.

@dmgr
dmgr / README.md
Created June 16, 2025 20:36 — forked from Lazza/README.md
VPNGate Python script

This script is NOT MAINTAINED

This snippet of code was posted in 2014 and slightly revised in 2016 and 2017. It was more of a quick'n'dirty script than a polished tool. It is made only for Linux and in Python 2, which has since become outdated.

I currently do not use it, and I suggest you avoid it as well. Please do not expect support for using this script.

🔥 If you need an alternative, @glaucocustodio has kindly suggested EasyVPN in this comment.

The rest of the README is left for historical purposed.

# dvorak layout
loadkeys dvorak
export HOSTNAME=thinkpad
export DEVICE=/dev/sda
export EFI_PARTITION=/dev/sda1
export ROOT_PARTITION=/dev/sda2
# as root
timedatectl set-ntp true
def flatten(unflattened_array, flattened_array = [])
unflattened_array.each do |v|
case v
when Array
flatten(v, flattened_array)
else
flattened_array << v
end
end
@dmgr
dmgr / cpulimit_bg.rb
Last active September 23, 2015 10:01
cpulimit background processes
def all_ps
# res = `ps -fxo pid,comm | awk '$2 ~ /_/ { print $1, $3 }'`
res = `ps -xo pid,comm`.downcase
res.lines.map { |line| line.split(/\s+/).last(2) }
end
def foreground_pid
command = 'ps -o pid,comm $(xprop -id $(xprop -root -f _NET_ACTIVE_WINDOW 0x " \$0\\n" _NET_ACTIVE_WINDOW | awk "{ print \$2 }") -f _NET_WM_PID 0c " \$0\\n" _NET_WM_PID | awk "{print \$2}")'
res = `#{ command }`
res.lines.last.split(/\s+/).last(2)
require 'ostruct'
ss = ["315c4eeaa8b5f8aaf9174145bf43e1784b8fa00dc71d885a804e5ee9fa40b16349c146fb778cdf2d3aff021dfff5b403b510d0d0455468aeb98622b137dae857553ccd8883a7bc37520e06e515d22c954eba5025b8cc57ee59418ce7dc6bc41556bdb36bbca3e8774301fbcaa3b83b220809560987815f65286764703de0f3d524400a19b159610b11ef3e", "234c02ecbbfbafa3ed18510abd11fa724fcda2018a1a8342cf064bbde548b12b07df44ba7191d9606ef4081ffde5ad46a5069d9f7f543bedb9c861bf29c7e205132eda9382b0bc2c5c4b45f919cf3a9f1cb74151f6d551f4480c82b2cb24cc5b028aa76eb7b4ab24171ab3cdadb8356f", "32510ba9a7b2bba9b8005d43a304b5714cc0bb0c8a34884dd91304b8ad40b62b07df44ba6e9d8a2368e51d04e0e7b207b70b9b8261112bacb6c866a232dfe257527dc29398f5f3251a0d47e503c66e935de81230b59b7afb5f41afa8d661cb", "32510ba9aab2a8a4fd06414fb517b5605cc0aa0dc91a8908c2064ba8ad5ea06a029056f47a8ad3306ef5021eafe1ac01a81197847a5c68a1b78769a37bc8f4575432c198ccb4ef63590256e305cd3a9544ee4160ead45aef520489e7da7d835402bca670bda8eb775200b8dabbba246b130f040d8ec6447e2c767f3d30ed81ea2e4c1404e1315a1010e7229be6636aaa", "3f