Skip to content

Instantly share code, notes, and snippets.

@fmassa
fmassa / query_distribution.py
Created June 28, 2020 16:11
Code to reproduce Fig 7 in "End to End Object Detection with Transformers"
# this file needs to be added to the root folder of detr github repo
import torch
import time
import torchvision
import numpy as np
import tqdm
import matplotlib.pyplot as plt
@dwcarr
dwcarr / deepInfraLangChain.ts
Created February 27, 2024 20:10
Langchain js custom chat model for Deep Infra
import type { BaseChatModelParams } from "@langchain/core/language_models/chat_models";
import {
type OpenAIClient,
type ChatOpenAICallOptions,
type OpenAIChatInput,
type OpenAICoreRequestOptions,
ChatOpenAI,
} from "@langchain/openai";
import { getEnvironmentVariable } from "@langchain/core/utils/env";
@PurpleVibe32
PurpleVibe32 / vmwk17key.txt
Last active May 9, 2024 22:16
Free VMware Workstation Pro 17 full license keys
Install VMWare Workstation PRO 17 (Read it right. PRO!)
Also, these keys might also work with VMWare Fusion 13 PRO. Just tested it.
Sub to me on youtube pls - PurpleVibe32
if you want more keys - call my bot on telegram. @purector_bot (THE BOT WONT REPLY ANYMORE) - Or: https://cdn.discordapp.com/attachments/1040615179894935645/1074016373228978277/keys.zip - the password in the zip is 102me.
---
This gist can get off at any time.
PLEASE, DONT COPY THIS. IF YOU FORK IT, DONT EDIT IT.
*If you have a problem comment and people will try to help you!
*No virus
@lpenz
lpenz / custom.toml
Created August 27, 2023 13:09
custom.toml example for Raspberry Pi OS
# Raspberry PI OS config.toml
# This file is used for the initial setup of the system on the first boot, if
# it's s present in the boot partition of the installation.
#
# This file is loaded by firstboot, parsed by init_config and ends up
# as several calls to imager_custom.
# The example below has all current fields.
#
# References:
# - https://github.com/RPi-Distro/raspberrypi-sys-mods/blob/master/usr/lib/raspberrypi-sys-mods/firstboot
@wojteklu
wojteklu / clean_code.md
Last active May 9, 2024 22:13
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@arthurmensch
arthurmensch / double_backward.py
Created May 19, 2018 10:25
Custom twice differentiable functions in Pytorch.
"""
Custom twice differentiable functions in Pytorch.
Author: Arthur Mensch
"""
import torch
import torch.nn as nn
@aamiaa
aamiaa / CompleteDiscordQuest.md
Last active May 9, 2024 22:09
Complete Recent Discord Quest

Complete Recent Discord Quest

Note

This no longer works in browser!

Note

This no longer works if you're alone in vc! Somebody else has to join you!

How to use this script:

  1. Accept the quest under User Settings -> Gift Inventory
@mildsunrise
mildsunrise / README.md
Last active May 9, 2024 22:12
Documentation of Tuya's weird compression scheme for IR codes

[Tuya][]'s IR blasters, like the [ZS08][], have the ability to both learn and blast generic IR codes. These IR codes are given to the user as an opaque string, like this:

A/IEiwFAAwbJAfIE8gSLIAUBiwFAC+ADAwuLAfIE8gSLAckBRx9AB0ADBskB8gTyBIsgBQGLAUALA4sB8gRAB8ADBfIEiwHJAeARLwHJAeAFAwHyBOC5LwGLAeA97wOLAfIE4RcfBYsB8gTyBEAFAYsB4AcrCYsB8gTyBIsByQHgPY8DyQHyBOAHAwHyBEAX4BVfBIsB8gTJoAMF8gSLAckB4BUvAckB4AEDBfIEiwHJAQ==

Not much is known about the format of these IR code strings, which makes it difficult to use codes obtained through other means (such as a

@andrewcchen
andrewcchen / tuya_ir_encode.js
Created August 13, 2023 19:44
Encode an NEC IR command into code for Tuya ZS06/ZS08/TS1201
/*
Encode an NEC IR command into code for Tuya ZS06/ZS08/TS1201
Usage: encode_nec("<four bytes in hex, two bytes of address followed by two bytes of command>")
If your address and/or command is just one byte (8 bits), append the complement of the byte after it to make it two bytes.
Example:
encode_nec("04fb08f7") // encodes nec address 0x04 and command 0x08
See:
@bmnepali
bmnepali / api.js
Created March 9, 2019 05:07
Redirect to login on 401 in react using axios
import axios from 'axios';
import Config from './app.config';
const instance = axios.create({
baseURL: Config.apiPath,
});
/**
* Catch the AunAuthorized Request
*/