Skip to content

Instantly share code, notes, and snippets.

@stek29
stek29 / tdget.py
Last active October 31, 2018 21:43
TDesktop link generator
from Crypto.Hash import SHA
from Crypto.Signature import PKCS1_v1_5
from Crypto.PublicKey import RSA
from base64 import urlsafe_b64encode
from requests import get
def get_version_signature(version, private_key):
signed_data = b'TelegramBeta_%x'%int(version)
#!/usr/bin/env bash
# See https://hub.zhovner.com/geek/universal-ikev2-server-configuration
# stek29 2018.11
set -euxo pipefail
DOMAIN=tunnel.example.com
IPv4_NET="10.1.1.0/24"
IPv6_NET="2a01:cafe:babe:feed:face::/112"
#!/usr/bin/env bash
set -euo pipefail
getlibs() {
otool -l "$1" |\
(grep -A2 LC_LOAD_DYLIB || true) |\
(grep name || true) |\
awk '{ print $2 }' |\
(grep '/usr/local' || true)
}
@stek29
stek29 / 0readme.md
Last active December 11, 2018 00:40

This Gist provides examples of providing global IPv6 addresses inside OpenVPN tunnel.

If you have /48 subnet which is most likely routed prefix, see https://community.openvpn.net/openvpn/wiki/IPv6 If you have /64 subnet which is most likely link prefix, see openvpn-link64-v6-over-v4.md file If you have some other configuration (i.e. just /124 -- digitalocean, i'm looking at you), or just want to use weirdest config ever, see openvpn-nat6.md (which is yet to be created)

All configurations I've tested work great on Windows, Linux, iOS and Android. For macOS, either use Viscosity (paid), or see Tunnelblick/Tunnelblick#452 for Tunnelblick.

@stek29
stek29 / all_dialogs.js
Last active February 16, 2019 23:01
Webogram Dialog loader
const angularGet = name => angular.element(document).injector().get(name);
const _invokeApi = angularGet('MtpApiManager').invokeApi;
const saveApiChats = angularGet('AppChatsManager').saveApiChats;
const saveApiUsers = angularGet('AppUsersManager').saveApiUsers;
const getInputPeerByID = angularGet('AppPeersManager').getInputPeerByID;
const getChat = angularGet('AppChatsManager').getChat;
const getUser = angularGet('AppUsersManager').getUser;
@stek29
stek29 / fixvenvopt.sh
Created March 27, 2019 20:19
Fix Cellar versioned links in virtualenvs
#!/usr/bin/env bash
# Python virtualenvs contain references to base python
# For brew installed python they reference versioned Cellar
# Which breaks even on minor update
# This hacky script rewrites all those references to opt based,
# unversioned ones.
#
# Example usage: fixvenvopt.sh ~/.virtualenvs/jupyter
set -euo pipefail
@stek29
stek29 / jira-ps-dumper.js
Created May 8, 2019 12:59
Dump Jira permission scheme into JSON
JSON.stringify(Object.fromEntries(Array.from(document.querySelectorAll('[data-permission-key]')).map(tr => {
let title = tr.querySelector('[class="title"]').innerText
let types = Object.fromEntries(Array.from(tr.querySelectorAll('[class="types"] dt')).map(dt => {
let sentence = dt.innerText
let next = dt.nextSibling
let values = (next !== null) ? [] : null
while (next !== null && next.tagName == "DD") {
values.push(next.innerText)
next = next.nextSibling
}
package main
import (
"bufio"
"fmt"
"os"
"strings"
"github.com/rivo/uniseg"
)
@stek29
stek29 / CREAT.py
Created August 10, 2019 00:09
park.mail.ru entry tests
class FUCK:
def __init__(self):
self.x = list()
self.n = 0
def CREATE(self, N):
self.n = N
self.x = [0] * self.n
def SET(self, L, R, val):
@stek29
stek29 / nocyril.go
Last active October 29, 2019 16:06
package main
import (
"context"
"errors"
"log"
"os"
"os/signal"
"regexp"
"strconv"