Skip to content

Instantly share code, notes, and snippets.

@robertklep
robertklep / gist:5124355
Created March 9, 2013 14:41
X11 keylogger
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <netdb.h>
#include <string.h>
#include <netinet/in.h>
#include <X11/X.h>
#include <X11/Xlib.h>
#include <X11/Intrinsic.h>
#include <X11/StringDefs.h>
@whjms
whjms / kobold-8bit.md
Last active April 7, 2023 16:35
Instructions for running KoboldAI in 8-bit mode

Running KoboldAI in 8-bit mode

tl;dr use Linux, install bitsandbytes (either globally or in KAI's conda env, add load_in_8bit=True, device_map="auto" in model pipeline creation calls)

Many people are unable to load models due to their GPU's limited VRAM. These models contain billions of parameters (model weights and biases), each of which is a 32 (or 16) bit float. Thanks to the hard work of some researchers [1], it's possible to run these models using 8-bit numbers, which halves the required amount of VRAM compared to running in half-precision. E.g. if a model requires 16GB of VRAM, running with 8-bit inference only requires 8GB.

This guide was written for KoboldAI 1.19.1, and tested with Ubuntu 20.04. These instructions are based on work by Gmin in KoboldAI's Discord server, and Huggingface's efficient LM inference guide.

Requirements

Differences Between Frequency and Presence Penalty

Frequency Penalty:

(based on training)

Frequency penalty parameter makes it less likely to predict words that the model has seen more frequently during its training.

This will encourage the model to generate novel or less common words. It works by scaling down the log probabilities of words that the model has seen frequently during training - making it less likely for the model to generate these common words (and thus common phrases).

Presence Penalty:

# nim c -r --threads:on --gc:orc
import cpuinfo, os, random, locks, deques
type
WorkReq = ref object
id: int
WorkRes = ref object
id: int
@varqox
varqox / recording_application_and_microphone.md
Last active March 7, 2024 17:59
How to record multiple applications and microphone into one audio file on Linux using PulseAudio

How to record multiple applications and microphone into one audio file on Linux

Step 0. Terminology

Sinks are for output, sources are for input. To stream source to sink a loopback must be created. More shall you find there.

Step 1. Create output sink that will be recorded

Our output sink will be named recording.

pacmd load-module module-null-sink sink_name=recording sink_properties=device.description=recording
@zacharycarter
zacharycarter / wclwn.md
Last active March 12, 2024 12:45
Binding to C Libraries with Nim
@haxscramper
haxscramper / languages-and-vms.md
Last active March 16, 2024 19:45
languages-and-vms
@XVilka
XVilka / TrueColour.md
Last active April 8, 2024 14:02
True Colour (16 million colours) support in various terminal applications and terminals

THIS GIST WAS MOVED TO TERMSTANDARD/COLORS REPOSITORY.

PLEASE ASK YOUR QUESTIONS OR ADD ANY SUGGESTIONS AS A REPOSITORY ISSUES OR PULL REQUESTS INSTEAD!

@Francesco149
Francesco149 / osu_on_linux_overhaul.md
Last active April 12, 2024 21:56
Ultimate guide to low-latency osu on linux
@kelvinn
kelvinn / cmd.sh
Created July 24, 2014 02:55
Example of using Apache Bench (ab) to POST JSON to an API
# post_loc.txt contains the json you want to post
# -p means to POST it
# -H adds an Auth header (could be Basic or Token)
# -T sets the Content-Type
# -c is concurrent clients
# -n is the number of requests to run in the test
ab -p post_loc.txt -T application/json -H 'Authorization: Token abcd1234' -c 10 -n 2000 http://example.com/api/v1/locations/