Skip to content

Instantly share code, notes, and snippets.

View 17twenty's full-sized avatar

Nick Glynn 17twenty

View GitHub Profile
@rain-1
rain-1 / llama-home.md
Last active February 22, 2024 05:52
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.
#!/bin/bash
# Make a PDF look scanned.
# Extracted from https://github.com/baicunko/scanyourpdf and modified for smaller output files (compression lower density).
INPUT_FILE=$1
/usr/local/bin/convert -density '80' ${INPUT_FILE} -colorspace 'gray' -linear-stretch '3.5%x10%' \
-blur '0x0.5' -attenuate '0.25' +noise Gaussian -rotate 0.5 \
-compress lzw -quality 50 scanned_${INPUT_FILE}
@Arinerron
Arinerron / permissions.txt
Last active March 27, 2024 04:59
A list of all Android permissions...
android.permission.ACCESS_ALL_DOWNLOADS
android.permission.ACCESS_BLUETOOTH_SHARE
android.permission.ACCESS_CACHE_FILESYSTEM
android.permission.ACCESS_CHECKIN_PROPERTIES
android.permission.ACCESS_CONTENT_PROVIDERS_EXTERNALLY
android.permission.ACCESS_DOWNLOAD_MANAGER
android.permission.ACCESS_DOWNLOAD_MANAGER_ADVANCED
android.permission.ACCESS_DRM_CERTIFICATES
android.permission.ACCESS_EPHEMERAL_APPS
android.permission.ACCESS_FM_RADIO
@17twenty
17twenty / bst_in_go.go
Last active November 6, 2015 03:13
Search/Insert and Traverse
package main
import (
"fmt"
"log"
)
type Node struct {
left *Node
right *Node
@17twenty
17twenty / vectorVsSlice.md
Created May 5, 2015 00:45
Since the introduction of the append built-in, most of the functionality of the container/vector package, which was removed in Go 1, can be replicated using append() and copy()

Here are the vector methods and their slice-manipulation analogues:

AppendVector

a = append(a, b...)

Copy

b = make([]T, len(a))
@17twenty
17twenty / learn_something_new.c
Created May 23, 2014 14:46
Learn something new about passing arrays, and how awful the syntax can be :D
/* gcc -std=c99 due to loop initialiser - stupid GCC defaulting to C89 :( */
#include <stdio.h>
#define ARRAY_SIZE(x) \
((sizeof(x) / sizeof(x[0])))
void count_and_process_items(unsigned int (*array)[10])
{
for (int i = 0; i < ARRAY_SIZE(*array); ++i) {
printf("Item %d = %d\n", i, (*array)[i]);
@Snaipe
Snaipe / malloc_article.md
Last active June 6, 2022 10:10
malloc_article

Please note that the article is now on my website, and even though I am still working on it, any feedback is appreciated. Thanks for reading !

On the Quest of recoding malloc(3)

Back when I did not know anything about programing and started to learn C, I was first introduced to pointers (and other dreaded horrors that made me curl into a corner and cry) and dynamic memory in general.

I was baffled, troubled, yet fascinated by the basic explanation on how memory worked, and started to dread the time where I would need to manually create my char arrays for each and every sentences of my program; right before learning about string literals and feeling like an idiot.

It was then where I was learning about memory allocation and came upon a function that I would call for long the "magic function" : malloc. Magic, because at that point I didn't know how it worked, let alone knew anything about memory other that it was a "chain of boxes for numbers".

@fkautz
fkautz / serverdemo.go
Created January 31, 2014 07:33
A simple demo of mixing various go http server and rpc using mux
package main
import (
"bytes"
"fmt"
"github.com/gorilla/mux"
grpc "github.com/gorilla/rpc"
"github.com/gorilla/rpc/json"
"log"
"net/http"
@17twenty
17twenty / am33xx.dtsi
Last active July 17, 2022 02:23
Example Platform Driver to set mux on Beaglebone based on device tree
/*
* Device Tree Source for AM33XX SoC
*
* Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
*
* This file is licensed under the terms of the GNU General Public License
* version 2. This program is licensed "as is" without any warranty of any
* kind, whether express or implied.
*/
@daeken
daeken / security.md
Created August 16, 2012 03:05
Outline
  • Intro
    • Mindset
      • Break all the things
    • Understanding is key
      • Security people are the most diverse in tech for that reason
  • Web security
    • Tools
      • Burp
    • XSS
    • CSRF