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 / Open TikTok App.user.js
Created March 30, 2024 10:09
userscript for ios to open modded tiktok through deeplinks. requires https://apps.apple.com/us/app/userscripts/id1463298887
// ==UserScript==
// @name Open TikTok App
// @version 1.0.0
// @author teidesu
// @match *://*.tiktok.com/*
// ==/UserScript==
let m = window.location.pathname.match(/^\/@[^\/]+\/video\/(\d+)/)
if (m !== null) {
window.location.href = `snssdk1233://aweme/detail/${m[1]}`;
}
@teidesu
teidesu / _nginx-web-auth
Last active June 8, 2023 19:00
web-based password protection, in pure nginx, with php support
dummy file for gist title
@teidesu
teidesu / baza76.js
Created October 17, 2022 15:25
hex и base64? нет, блин, НЁХ и БАЗА76
// не бейте за кринж код, писала на коленке по фану
const HEX_ALPHABET = '0123456789абвгде'
const B76_ALPHABET =
'АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдеёжзийклмнопрстуфхцчшщъыьэюя0123456789'
function toНёх(buf) {
let ret = ''
for (let i = 0; i < buf.length; i++) {
const byte = buf[i]
@teidesu
teidesu / mosru-ege-check.js
Created June 14, 2022 21:25
idk why i made this. this checks ege (use) results via mos.ru
const _got = require('got')
const cheerio = require('cheerio')
// cookie хедер с mos.ru
const COOKIE = ''
// код регистрации
const REG_CODE = '1234-5678-9012'
// номер документа без серии
const DOC_NUM = '123456'
@teidesu
teidesu / prefixed-localstorage.js
Last active September 23, 2022 12:18
Proxy for localStorage that prefixes all keys.
const prefix = 'prefix_'
const rawLS = window.localStorage
const wrappedLS = new Proxy(rawLS, {
get(target, prop, receiver) {
if (typeof target[prop] === 'function') {
return function(key, value) {
return target[prop](prefix + key, value)
}
}
@teidesu
teidesu / drklo-emoji-ripper.js
Created June 22, 2021 13:12
Utility to rip emojis and generate sprite sheets and meta information for them.
/**
* Emoji sprite and data generator.
*
* Data is taken from frankerfacez.com and name->char index is generated.
*
* Sprite generator works by parsing some of the code in DrKLO/Telegram (Telegram for Android)
* and downloading emoji files contained there, while generating code and sprite.
*
* Can easily be modified to generate JSON instead of CSS or to download from some other source.
* Can also be easily ported to TypeScript
@teidesu
teidesu / KawaiiCircularProgress.java
Created June 22, 2021 13:12
Kawaii material circular progress for android. preview: https://imgur.com/49Qs6GT
package desu.player.views;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.view.View;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.view.animation.Interpolator;
@teidesu
teidesu / success-race.js
Created June 22, 2021 13:11
Promise.race but error-tolerant
/**
* Similar to Promise.race(), but resolves once one of the promises
* resolve to a successful value and didn't throw error.
* A promise result is considered `successful` when
* check(result) resolves to a truthy value.
*
* When all promises resulted with unsuccessful values, `null` is returned,
* otherwise result of first successful one is returned
*
@teidesu
teidesu / torrent-to-magnet.js
Created June 22, 2021 13:11
Simple NodeJS function to convert .torrent files to magnet URIs
// This file is licensed under LGPLv3
// (c) teidesu 2020
const qs = require('querystring')
const crypto = require('crypto')
// https://gist.github.com/teidesu/a1eadf71ffd88166415e2ea8b94d3f3b
const bencode = require('./bencode')
function convert (file) {
const data = bencode.decode(f)
@teidesu
teidesu / base32.js
Created June 22, 2021 13:11
JavaScript Base32 implementation
// This file is licensed under LGPLv3
// (c) teidesu 2020
const alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567'
const padLength = [0, 1, 3, 4, 6]
const padChar = '='
function encode (buf) {
let arr = [...buf]
let len = arr.length
let ret = ''