Skip to content

Instantly share code, notes, and snippets.

@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
}
@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 / proxygram-nginx.conf
Created February 24, 2019 21:52
config for nginx to proxy webogram
server {
server_name gram.com;
location / {
root /var/www/gram;
try_files $uri $uri/index.html;
# protect with basic auth, we don't want to get banned by rkn
auth_basic "webogram";
auth_basic_user_file /var/www/gram.htpasswd;
@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 / idevicerestore.sh
Created January 12, 2019 12:22
idevicerestore on linux (Debian-based)
sudo apt update
# sudo apt upgrade
sudo apt install -y libcurl4-openssl-dev libplist-dev libzip-dev openssl libssl-dev libusb-1.0-0-dev libreadline-dev build-essential git make automake libtool pkg-config
git clone https://github.com/libimobiledevice/libirecovery
git clone https://github.com/libimobiledevice/idevicerestore
git clone https://github.com/libimobiledevice/usbmuxd
git clone https://github.com/libimobiledevice/libimobiledevice
git clone https://github.com/libimobiledevice/libusbmuxd
git clone https://github.com/libimobiledevice/libplist
#!/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)
}
#!/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"
@stek29
stek29 / example_dll.cpp
Created November 5, 2018 17:18
cross-build 32bit rundll32'able DLL with mingw
#undef UNICODE
#define UNICODE
#include <windows.h>
#include <stdio.h>
// i686-w64-mingw32-g++ -shared -o ExampleDll.dll example_dll.cpp -Wl,--out-implib,libExampleDll.dll -static -lgcc example_dll.def
//
// example_dll.def:
// EXPORTS
// RunDllMe=RunDllMe@16
import telethon.sync
from telethon.tl.types import WallPaper
from telethon.tl.functions.account import GetWallPapersRequest
# see telethon docs to get client
w = client(GetWallPapersRequest())
for i, wp in enumerate(w):
@stek29
stek29 / nocyril.go
Last active October 29, 2019 16:06
package main
import (
"context"
"errors"
"log"
"os"
"os/signal"
"regexp"
"strconv"