Skip to content

Instantly share code, notes, and snippets.

View teidesu's full-sized avatar
🌸
meow?

alina sireneva teidesu

🌸
meow?
View GitHub Profile
@teidesu
teidesu / bencode.js
Created June 22, 2021 13:11
JavaScript BEncode implementation
// This file is licensed under LGPLv3
// (c) teidesu 2020
class Decoder {
pos = 0
constructor (str) {
this.str = str
}
decode () {
@teidesu
teidesu / create-sse.ts
Created June 22, 2021 13:11
simple sse for koa
import { Context } from 'koa'
function isPojo (obj: any): boolean {
return obj && typeof obj === 'object' && obj.constructor === Object
}
export interface SseController {
emit (options?: SseEmitOptions): void
close (): void
@teidesu
teidesu / exloader.js
Created June 22, 2021 13:11
Simple script to download galleries from exhentai.org w/out GPs, H@H or torrents.
#!/usr/bin/env node
/*
Simple script to download galleries from exhentai.org w/out GPs, H@H or torrents
Requires node >= 10 to run (uses fs.promises)
Dependencies:
yarn add cheerio node-fetch mime-types
# or
npm install cheerio node-fetch mime-types
@teidesu
teidesu / linked-list.js
Created June 22, 2021 13:11
Linked list for JavaScript without using native arrays. Pretty untested, but kind of works
export class LinkedList {
constructor () {
this._first = null
this._last = null
this.length = 0
}
push (item) {
let value = {
prev: null,
@teidesu
teidesu / firefox-pass-export.js
Created June 22, 2021 13:11
Small script for exporting passwords from Firefox Lockwise to Chrome CSV
/*
Small script for exporting passwords from Firefox Lockwise to Chrome CSV
Usage:
1. Open passwords page (about:logins)
2. Open devtools (F12)
3. Paste the following script
4. Wait a few seconds, a download prompt will appear.
Tested with 70.0.1 (64-bit) (Linux x64)
(c) teidesu 2019. This script is licensed under GPLv3
@teidesu
teidesu / update-cf-dns.sh
Created June 22, 2021 13:11
update ip in cloudflare dns for those nibbas who has dynamic ip
#!/bin/bash
API_KEY="..."
ZONE_ID="..."
RECORD_ID="..."
ADDRESS="..."
curl -X PUT "https://api.cloudflare.com/client/v4/zones/$ZONE_ID/dns_records/$RECORD_ID" \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" --data "{\"type\": \"A\", \"name\": \"$ADDRESS\", \"content\": \"$(curl ipv4.icanhazip.com)\", \"proxied\": false}"
@teidesu
teidesu / telegram_postgres_backup.sh
Created June 22, 2021 13:11
small script for automating postgres database backup and sending it to telegram
#!/bin/bash
# To generate public key:
# openssl req -x509 -nodes -days 1000000 -newkey rsa:4096 -keyout backup_key.pem\
# -subj "/C=US/ST=Illinois/L=Chicago/O=IT/CN=www.example.com" \
# -out backup_key.pem.pub
#
# To decrypt:
# openssl smime -decrypt -in some.bin -binary -inform DEM -inkey your.pem | bzcat > some.pg
@teidesu
teidesu / ym_recognition.py
Created June 22, 2021 13:11
small script that (ab)uses Yandex Music Recognition.
"""
This is small script that (ab)uses Yandex Music Recognition.
I hope the code is self-documented <3
Notice! Input file should be .ogg file, preferably with libopus encoder
(untested with other encoders)
(c) teidesu, 2019. This script is licensed under GPLv3 license.
"""
import lomond
import uuid as uuid_py
@teidesu
teidesu / vk-audio.js
Created June 22, 2021 13:11
VK token refresh script for audio in JS, based on Vodka2 implementation
/*
* VK token refresh script for audio.
* The only dependency is axios.
* Can be simply embedded in your app:
* const { refreshToken } = require('./vk-audio')
* ...
* refreshToken(oldToken)
*
* Note that you will need to use Kate Mobile's token and user agent, for example:
* KateMobileAndroid/52.1 lite-445 (Android 4.4.2; SDK 19; x86; unknown Android SDK built for x86; en)
/*
* Script for checking whether the Telegram username is occupied.
* Uses t.me (or its mirrors, configurable as a second parameter), so there are no
* flood limits.
* Usage:
* const checkUsername = require('./tg-username-checker')
* // ...
* await checkUsername('someone')
* await checkUsername('someone', 'telesco.pe')
* Alternatively, can be used as an interactive CLI when ran directly.