Skip to content

Instantly share code, notes, and snippets.

View kataki's full-sized avatar

kataki kataki

View GitHub Profile
@kataki
kataki / ConditionalOtpFormAuthenticator.java
Created February 11, 2026 12:25 — forked from thomasdarimont/ConditionalOtpFormAuthenticator.java
Keycloak Conditional OTP Step-by-Step
package org.keycloak.authentication.authenticators.browser;
import org.keycloak.authentication.AuthenticationFlowContext;
import org.keycloak.models.RoleModel;
import org.keycloak.models.UserModel;
import javax.ws.rs.core.MultivaluedMap;
import java.util.List;
import java.util.Map;
import java.util.regex.Pattern;

Cursor's Memory Bank

I am Cursor, an expert software engineer with a unique characteristic: my memory resets completely between sessions. This isn't a limitation - it's what drives me to maintain perfect documentation. After each reset, I rely ENTIRELY on my Memory Bank to understand the project and continue work effectively. I MUST read ALL memory bank files at the start of EVERY task - this is not optional.

Memory Bank Structure

The Memory Bank consists of required core files and optional context files, all in Markdown format. Files build upon each other in a clear hierarchy:

flowchart TD
#!/bin/bash
function speed_test_by_url(){
local url=$1
for x in $(curl -qs "$url")
do
speed=$(curl --max-time 10 --resolve cdn.cloudflare.steamstatic.com:443:$x https://cdn.cloudflare.steamstatic.com/steam/apps/256843155/movie_max.mp4 -kw "%{speed_download}" -o /dev/null)
speed=$(echo $speed| awk -F. '{print $1}')
speed=$((speed / 1024 / 1024))
@kataki
kataki / network-check.sh
Created November 22, 2024 11:51 — forked from Ansen/network-check.sh
Automatically restart the device when the network is unavailabled
#!/bin/bash
. /etc/profile > /dev/null 2>&1
# PUB_DNS='1.1.1.1'
# CHINA ONLY
PUB_DNS='223.5.5.5'
# percentage
REBOOT_THRESHOLD=80
#!/bin/bash
# Author: An Shen
# Date: 2023-01-30
. /etc/profile
function log(){
echo "[$(date +'%Y-%m-%d %H:%M:%S')] - $1"
}
@kataki
kataki / Gmail Filter by Search Query.md
Created January 1, 2022 21:57 — forked from dead-claudia/Gmail Filter by Search Query.md
Gmail script filter based on search queries

Gmail Filter by Search Query

This program, in the form of a configuration script and a main script, allows for complicated Gmail search queries to be used as filters. It also lets you do more advanced stuff you can't do with ordinary filters, like label based on whether an email contains a specific kind of attachment.

Installing

  1. Go to script.google.com.
  2. Go to File > New > Script File, and type Main as the title for the new script. This will be for the main script.
  3. Delete any pre-filled text in the script file, and copy main.gs from this gist to that file.
  4. Go to File > New > Script File again, and type Config as the title for the new script. This will be for configuration.
@kataki
kataki / tutorial.md
Created December 31, 2021 12:04 — forked from dhinakg/tutorial.md
iOS/iPadOS 14.3 OTA
@kataki
kataki / AuthyToOtherAuthenticator.md
Created December 29, 2021 15:00 — forked from gboudreau/AuthyToOtherAuthenticator.md
Export TOTP tokens from Authy

Generating Authy passwords on other authenticators


There is an increasing count of applications which use Authy for two-factor authentication. However many users who aren't using Authy, have their own authenticator setup up already and do not wish to use two applications for generating passwords.

Since I use 1Password for all of my password storing/generating needs, I was looking for a solution to use Authy passwords on that. I couldn't find any completely working solutions, however I stumbled upon a gist by Brian Hartvigsen. His post had a neat code with it to generate QR codes for you to use on your favorite authenticator.

His method is to extract the secret keys using Authy's Google Chrome app via Developer Tools. If this was not possible, I guess people would be reverse engineering the Android app or something like that. But when I tried that code, nothing appeared on the screen. My guess is that Brian used the

#!/usr/bin/env python3
from Crypto.Cipher import AES
from Crypto.Util.Padding import pad, unpad
from hashlib import pbkdf2_hmac, sha1
import os, tempfile, argparse
import struct, plistlib, sqlite3
from bpylist2 import archiver
class MBFile: