Skip to content

Instantly share code, notes, and snippets.

@ForsakenHarmony
ForsakenHarmony / protocol.md
Last active May 10, 2024 10:27
dbx DriveRack PA2 protocol exploration

PA2 protocol

  • port: 19272
  • protocol: text over TCP (UDP might also be possible)

PA2 Control

Searching for devices

Broadcast (UDP)

#include <stdio.h>
#include <stdlib.h>
struct node{
int data;
struct node* next;
}*head = NULL;
void insert(int data){
struct node* newNode;
newNode = (struct node*)malloc(sizeof(struct node));
@cybik
cybik / README.md
Last active May 10, 2024 10:25
GDM with KDE: a dumb revelation

The Neckbeard

Hi. I'm cybik. Look for me around the internet.

The Background

I used Pop_OS. I kinda liked GDM because of its sleekiness, simplicity, yet overall subdued tones. But I use KDE since GNOME can't actually implement interesting features or actual desktop UX to save its life.

The Issue

@y0ngb1n
y0ngb1n / docker-registry-mirrors.md
Last active May 10, 2024 10:22
国内的 Docker Hub 镜像加速器,由国内教育机构与各大云服务商提供的镜像加速服务 | Dockerized 实践 https://github.com/y0ngb1n/dockerized

Docker Hub 镜像加速器

国内从 Docker Hub 拉取镜像有时会遇到困难,此时可以配置镜像加速器。Docker 官方和国内很多云服务商都提供了国内加速器服务。

Dockerized 实践 https://github.com/y0ngb1n/dockerized

配置加速地址

Ubuntu 16.04+、Debian 8+、CentOS 7+

@tuxity
tuxity / navicat_premium_reset_trial.sh
Last active May 10, 2024 10:17
Reset Navicat Premium 15/16 remaining trial days
#!/bin/bash
set -e
file=$(defaults read /Applications/Navicat\ Premium.app/Contents/Info.plist)
regex="CFBundleShortVersionString = \"([^\.]+)"
[[ $file =~ $regex ]]
version=${BASH_REMATCH[1]}
@renich
renich / 00-gentoo-installation-partitioning.bash
Last active May 10, 2024 10:16
Install Gentoo on BtrFS subvolumes + UEFI
#!/usr/bin/env bash
# WARNING!!
# This will obliterate all the data in your partition!! (not actually true, but act as if it was)
# Do NOT execute this script if you don't fully understand it!
# a few vars
amount_of_swap=$( free --si -g | grep Mem: | gawk '{ print $2 + 1}' )
# create directories
@mjbalcueva
mjbalcueva / password-input.tsx
Last active May 10, 2024 10:14
shadcn ui custom password input
"use client"
import { forwardRef, useState } from "react"
import { EyeIcon, EyeOffIcon } from "lucide-react"
import { Button } from "@/components/ui/button"
import { Input, InputProps } from "@/components/ui/input"
import { cn } from "@/lib/utils"
const PasswordInput = forwardRef<HTMLInputElement, InputProps>(
({ className, ...props }, ref) => {
@RodrigoCMoraes
RodrigoCMoraes / install-nvidia-docker.sh
Last active May 10, 2024 10:13
Install nvidia docker in Ubuntu 18.04
#1. Update system
sudo apt-get update
#2.Install packages to allow apt to use a repository over HTTPS:
sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
software-properties-common
Home/Core TX9XD-98N7V-6WMQ6-BX7FG-H8Q99
Home/Core (Country Specific) PVMJN-6DFY6-9CCP6-7BKTT-D3WVR
Home/Core (Single Language) 7HNRX-D7KGG-3K4RQ-4WPJ4-YTDFH
Home/Core N 3KHY7-WNT83-DGQKR-F7HPR-844BM
Professional W269N-WFGWX-YVC9B-4J6C9-T83GX
Professional N MH37W-N47XK-V7XM9-C7227-GCQG9
Professional Enterprise
Professional Workstation
Enterprise NPPR9-FWDCX-D2C8J-H872K-2YT43
Enterprise N DPH2V-TTNVB-4X9Q3-TJR4H-KHJW4
@wassname
wassname / choice_tree.py
Last active May 10, 2024 10:08
for huggingface transformers sometime you want to constrain output to json schema and record the probabilities on choices/enums. I use it when rating, judging. It's much more efficient than sampling multiple times.
from jaxtyping import Float, Int
import torch
from torch.nn import functional as F
from torch import Tensor
from typing import List, Callable, Tuple, Dict, Optional
import pandas as pd
from transformers import AutoModelForCausalLM, AutoTokenizer
def get_valid_next_choices(choices_tokens, current_tokens):