Skip to content

Instantly share code, notes, and snippets.

View flxxyz's full-sized avatar
🙏
happening

一个不知名の睡觉高手 flxxyz

🙏
happening
View GitHub Profile
@flxxyz
flxxyz / README.md
Created May 6, 2025 08:34 — forked from chowder/README.md
Exporting Microsoft Authenticator TOTP secrets

Background

Workplaces may enforce TOTP 2FA to be enabled Office 365 accounts, which require the Microsoft Authenticator app to be installed.

Regular TOTP applications (such as Aegis, Authy, or LastPass) cannot be used as Microsoft uses a proprietary scheme called phonefactor. Furthermore, the application requires Google Services Framework (GSF) to be installed (likely to provide device notifications), and will refuse to work when it is not present on the device.

Forunately, after the registration is complete, the underlying mechanism the app uses to generate TOTP codes is regular otpauth, and its secrets can be exported with a little bit of effort.

Extracting the keys

@flxxyz
flxxyz / gist:bc90d9e2f14dff33241eaefae0fb2542
Created April 14, 2025 05:30 — forked from iscle/gist:66e946553e74a883b4494d3b6df0ee82
Install python2.7 on Ubuntu 23.04 as "python"
wget https://www.python.org/ftp/python/2.7.18/Python-2.7.18.tgz
tar xzf Python-2.7.18.tgz
cd Python-2.7.18
sudo ./configure --enable-optimizations
sudo make altinstall
sudo ln -s "/usr/local/bin/python2.7" "/usr/bin/python"

AWS 的数据传输类型大致有如下三类:

  • 与 Internet 之间的数据传输
  • AWS 内部跨区域的数据传输
  • AWS 内部同一区域的数据传输

每个区域从 AWS 到 Internet 的数据传输费率都不一样,基本是 下行免费,上行收费,费率算总量

https://aws.amazon.com/cn/ec2/pricing/on-demand/ ---> 数据传输部分


@flxxyz
flxxyz / memory.ts
Created April 2, 2024 08:53
javascript cache adaptor
export interface Cache {
addValue(key: any, value: any, ttl?: number): void | Promise<void>;
getValue(key: any): Promise<T>;
hasExpired(key: string): boolean | Promise<boolean>;
deleteValue(key: string): T | Promise<T>;
}
export class MemoryCache extends Map implements Cache {
addValue(key: any, value: any, ttl?: number) {
if (typeof ttl !== 'number') {
@flxxyz
flxxyz / callbacks.ts
Created April 2, 2024 08:47
javascript event callbacks
export type Callback = (...args: any[]) => any;
export class Callbacks {
#callbacks: Map<string, Callback[]>;
constructor() {
this.#callbacks = new Map();
}
add(name: string, fn: any) {
@flxxyz
flxxyz / docker-compose.yml
Last active December 17, 2023 08:08
一键kafka(带面板)
version: '2.1'
services:
kafka-ui:
container_name: kafka-ui
image: provectuslabs/kafka-ui:latest
ports:
- "9888:8080"
environment:
DYNAMIC_CONFIG_ENABLED: "true"
import crypto from 'crypto';
export default class AESCipher {
#key: Buffer;
constructor(key: string) {
const hash = crypto.createHash('sha256');
hash.update(key);
this.#key = hash.digest();
}
@flxxyz
flxxyz / test.sh
Created May 11, 2023 11:14
简单的linux测试读写
写测试
```
time dd if=/dev/zero of=/tmp/test bs=8k count=1000000
```
读测试
```
time dd if=/tmp/test of=/dev/null bs=8k
@flxxyz
flxxyz / index.html
Last active June 19, 2023 10:48
mirror.flxxyz.com nginx反代配置(gist.github.com & open.douyucdn.cn & raw.githubusercontent.com & gist.githubusercontent.com)
<!DOCTYPE html>
<html>
<head>
<meta name="content-type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=5.0, viewport-fit=cover" />
<title>hello mirror</title>
</head>
<body>
<h1>Hello Mirror</h1>
<h2>Support Server</h2>
@flxxyz
flxxyz / sysctl.conf
Last active October 9, 2022 03:39 — forked from chenshaoju/sysctl.conf
sysctl.conf
#
# /etc/sysctl.conf - Configuration file for setting system variables
# See /etc/sysctl.d/ for additonal system variables
# See sysctl.conf (5) for information.
#
#kernel.domainname = example.com
# Uncomment the following to stop low-level messages on console
#kernel.printk = 3 4 1 3