Skip to content

Instantly share code, notes, and snippets.

View alexanderadam's full-sized avatar
⌨️
⌨️

Alexander ADAM alexanderadam

⌨️
⌨️
View GitHub Profile
@schacon
schacon / git-related-files.rb
Last active February 17, 2025 10:04
git-related-files.sh
@stufro
stufro / return_mocked_object.cr
Created May 20, 2023 14:30
Crystal Spectator - using `inject_mock`
# spec.cr
require "spectator"
require "./spec_helper"
Spectator.describe OrderCalculator do
inject_mock Database
def_mock(Product)
it "multiplies the product price by given quantity" do
product = new_mock(Product)
@rain-1
rain-1 / llama-home.md
Last active June 24, 2025 11:12
How to run Llama 13B with a 6GB graphics card

This worked on 14/May/23. The instructions will probably require updating in the future.

llama is a text prediction model similar to GPT-2, and the version of GPT-3 that has not been fine tuned yet. It is also possible to run fine tuned versions (like alpaca or vicuna with this. I think. Those versions are more focused on answering questions)

Note: I have been told that this does not support multiple GPUs. It can only use a single GPU.

It is possible to run LLama 13B with a 6GB graphics card now! (e.g. a RTX 2060). Thanks to the amazing work involved in llama.cpp. The latest change is CUDA/cuBLAS which allows you pick an arbitrary number of the transformer layers to be run on the GPU. This is perfect for low VRAM.

  • Clone llama.cpp from git, I am on commit 08737ef720f0510c7ec2aa84d7f70c691073c35d.
@kddnewton
kddnewton / json.rb
Last active August 7, 2023 19:54
Faster JSON parser in Ruby
# frozen_string_literal: true
require "bundler/inline"
gemfile do
source "https://rubygems.org"
gem "json_pure"
gem "benchmark-ips"
end
interface Iterator<T, TReturn = any, TNext = undefined> {
next(): {
done: boolean
value: T
}
/** Returns an iterator of the elements with the given mapping function applied. */
map<TT>(
/** A mapping function to call on every element of the iterator. */
callback: (value: T) => TT
var tryCount = 0;
var minimalUserResponseInMiliseconds = 200;
function check() {
console.clear();
before = new Date().getTime();
debugger;
after = new Date().getTime();
if (after - before > minimalUserResponseInMiliseconds) {
document.write(" Dont open Developer Tools. ");
self.location.replace(window.location.protocol + window.location.href.substring(window.location.protocol.length));
@timohuovinen
timohuovinen / virtualbox-windows.md
Last active March 31, 2024 11:48
Create and run a windows virtual machine using virtualbox

Virtualbox (free and open-source)

How to install an unlicensed copy of windows using virtualbox

  1. Install virtualbox 7 (or higher)
    1. Ubuntu 22.04 jammy for linux mint 21
    2. Download extensions pack for the same version.
  2. Virtualbox > Tools > Install Oracle VM Virtualbox Extensions Pack for the same version
  3. Download Windows 10 pro from Microsoft
  4. Create a machine
    1. System > Motherboard > Check EFI and Secure boot (boot order won’t work with EFI, required for windows 11)
  5. System > Motherboard > Check TPM 2.0 (Security chip emulation)
@MarioRuiz
MarioRuiz / smart-lola.rb
Created October 13, 2022 14:48
Learn to write Spanish and English words. Aprende a escribir palabras en Inglés y Español
# Requires an Apple Mac and Ruby
# I created this gist just to help my daughter to learn how words are written in Spanish and English.
# The script will pronounce a random word in the language selected and the child needs to write the word letter by letter.
require 'string_pattern'
require 'open3'
require 'io/console'
ENV['NOMBRE'] ||= 'Pedro'
ENGLISH = ENV['ENGLISH'] == 'true'
@dxdxdt
dxdxdt / fuckyou-gmail.en.md
Last active September 7, 2023 17:44
What to do when Gmail marks all the mails from your server as spam

What to do when Gmail marks all the mails from your server as spam

If you're self-hosting your services and having trouble getting your emails through Gmail and infuriated by Google's non-existent support, you're not the only one. I'd like to share my experiences trying to get it sorted out.

I'm the author of the post above. You can tell how arrogant Google employees are from all the previous posts he made in the past.

Model.where("column LIKE #{sanitize_sql_like(Arel.sql('%?%'), value)}")
.or(Model.where("column LIKE #{sanitize_sql_like(Arel.sql('%?%'), value)}"))