Skip to content

Instantly share code, notes, and snippets.

@ZCube
ZCube / Ajazz_Stream_Deck_Protocol.md
Created May 13, 2024 17:53
Notes on the Ajazz Stream Deck HID protocol

Ajazz Stream Deck Protocol

How to interface with a Ajazz Stream Deck device.

Synopsis

The device uses the HID protocol to communicate with its software.

Configuration

The number of keys can be determined from the HID device descriptors. There is currently no known provision to determine their layout or size. The buttons on the current version of the device (AKP153)

@itswzyss
itswzyss / gumroad_bulk_download.js
Last active May 14, 2024 10:42
Bulk Download Gumroad Library
// In light of the TOS change at Gumroad, I've modified a script by @Fhurai that will categorize all the download links with their
// original asset page. In order to use this, navigate to https://app.gumroad.com/library and open your DevTools. Then paste the
// following code into the Console. See more info at https://blog.wzyss.dev/easily-archive-your-gumroad-library/
async function fetchUrls(link) {
// Fetch and process URLs from the given link
return fetch(link)
.then(res => res.text())
.then(text => {
let parser = new DOMParser();
@thomasbnt
thomasbnt / code_colors_discordjs.md
Last active May 14, 2024 10:42
Code colors for embed discord.js

Here is an updated list of the colors that are currently implemented with a name. To using colors on discord.js, this is a typedef Colors, Colors.Aqua to get the Aqua color.

Name Int value Hex Code
Default 0 #000000
Aqua 1752220 #1ABC9C
DarkAqua 1146986 #11806A
Green 5763719 #57F287
DarkGreen 2067276 #1F8B4C
# import required libraries
import pandas as pd
import yfinance as yf
import numpy as np
import math
# get stock prices
df = yf.download('AAPL', start='2020-01-01', threads= False)
# parameter setup
@xiabingquan
xiabingquan / transformer_all_in_one.py
Created December 6, 2023 14:52
Implement Transformer from scratach. All modules included in one file!
# coding=utf-8
# Contact: bingquanxia@qq.com
import numpy as np
import torch
import torch.nn as nn
def get_len_mask(b: int, max_len: int, feat_lens: torch.Tensor, device: torch.device) -> torch.Tensor:
@virgiliu
virgiliu / gumroad_bulk_download
Created November 1, 2020 14:13
Gumroad bulk download
// Run this in the content download page and it will trigger download for everything
var sleep = (milliseconds) => {
return new Promise(resolve => setTimeout(resolve, milliseconds))
}
var waitTime = 1500; //ms
var x = $( "button:contains('Download')" );
@vades
vades / angular-expression-changed.md
Last active May 14, 2024 10:35
Fixing "Expression has changed after it was checked" in Angular

Fixing "Expression has changed after it was checked" in Angular

The exception appears (in the development mode) at the moment the value is checked and value is different of the updated value.

Error message example

AppComponent.html:1 ERROR Error: ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value: 'ngIf: true'. Current value: 'ngIf: false'.
    at viewDebugError (core.js:20440)
    at expressionChangedAfterItHasBeenCheckedError (core.js:20428)
    at checkBindingNoChanges (core.js:20530)
@CaroManel
CaroManel / git-reset-remote.sh
Created March 2, 2017 03:41
Reset remote git repository to delete all commits
rm -r .git
git init
(create files)
git add -A
git commit -m 'Initial commit'
git remote add origin <url>
git push --force --set-upstream origin master
@edecoux
edecoux / John Carmack.md
Last active May 14, 2024 10:32
John Carmack.md

John Carmack is an influential computer programmer, video game developer, and engineer, best known for his work on popular first-person shooter games such as Wolfenstein 3D, Doom, and Quake. Born on August 20, 1970, in Shawnee Mission, Kansas, Carmack co-founded id Software in 1991, which became a pioneering company in the video game industry.

Carmack's work at id Software was instrumental in developing and popularizing the first-person shooter genre. He was also an early advocate for open-source software and made significant contributions to the development of real-time 3D graphics. As a result, his programming techniques have had a lasting impact on the video game industry.

In addition to his work in gaming, Carmack is also known for his interest in aerospace and virtual reality. In 2000, he founded [Armadil

@ctlllll
ctlllll / longest_chinese_tokens_gpt4o.py
Created May 13, 2024 19:53
Longest Chinese tokens in gpt4o
import tiktoken
import langdetect
T = tiktoken.get_encoding("o200k_base")
length_dict = {}
for i in range(T.n_vocab):
try:
length_dict[i] = len(T.decode([i]))
except: