Skip to content

Instantly share code, notes, and snippets.

@MrJohnsson77
MrJohnsson77 / ollama.txt
Created December 22, 2023 16:07 — forked from mchiang0610/ollama.txt
ollama run models - august 10 2023
codeup:13b
codeup:13b-llama2
codeup:13b-llama2-chat
codeup:13b-llama2-chat-q2_K
codeup:13b-llama2-chat-q3_K_L
codeup:13b-llama2-chat-q3_K_M
codeup:13b-llama2-chat-q3_K_S
codeup:13b-llama2-chat-q4_0
codeup:13b-llama2-chat-q4_1
codeup:13b-llama2-chat-q4_K_M
@MrJohnsson77
MrJohnsson77 / umbrel-ubuntu-20-04-x86.md
Created April 4, 2021 15:46 — forked from mayankchhabra/umbrel-ubuntu-20-04-x86.md
Installing Umbrel on Ubuntu 20.04 x86

Install Umbrel v0.3.5

sudo fallocate -l 4G /swapfile
sudo chmod 600 /swapfile
sudo swapon /swapfile
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
sudo sysctl vm.swappiness=10
echo 'vm.swappiness=10' | sudo tee -a /etc/sysctl.conf
sudo sysctl vm.vfs_cache_pressure=50
@MrJohnsson77
MrJohnsson77 / vanilla-ajax-poll.js
Created June 16, 2019 20:27 — forked from twmbx/vanilla-ajax-poll.js
Polling in JS with an async ajax call that returns a promise ( modified from: https://davidwalsh.name/javascript-polling )
// The polling function
function poll(fn, timeout, interval) {
var endTime = Number(new Date()) + (timeout || 2000);
interval = interval || 100;
var checkCondition = function(resolve, reject) {
var ajax = fn();
// dive into the ajax promise
ajax.then( function(response){
// If the condition is met, we're done!
@MrJohnsson77
MrJohnsson77 / sqlalchemy_example.py
Created November 28, 2018 11:37 — forked from podhmo/sqlalchemy_example.py
sqlalchemy query example.
import sqlalchemy as sa
import sqlalchemy.orm as orm
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.ext.declarative import declared_attr
from sqlalchemy.orm import scoped_session, sessionmaker
DBSession = scoped_session(sessionmaker())
class BaseMixin(object):
query = DBSession.query_property()
id = sa.Column(sa.Integer, primary_key=True)
@MrJohnsson77
MrJohnsson77 / eventListener.js
Created November 10, 2018 23:39 — forked from shayanb/eventListener.js
simple NodeJS app to display triggered events on a smart contract
// This is a simple NodeJS app to display triggered events on a smart contract
// you need your contract ABI and deployed address and also a synced geth running
// github.com/shayanb
var optionsABI = [YOUR_CONTRACT_ABI]
var contractAddress = "0xYOUR_CONTRACT_ADDRESS"
var Web3 = require('web3');
@MrJohnsson77
MrJohnsson77 / gist:780aa68fb353b190990fbdd5e71ed000
Created May 29, 2016 02:12 — forked from radiosilence/gist:5714387
Example uWSGi INI file with support for celery.
[uwsgi]
disable-logging = True
socket = /srv/qrs/test/wsgi.sock
chdir = /srv/qrs/test
chmod = 660
master = true
processes = 2
module = qrs.wsgi:application
virtualenv = /env/qrs/test
enable-threads = true
@MrJohnsson77
MrJohnsson77 / ubuntu_py3.md
Created April 26, 2016 14:50 — forked from softwaredoug/ubuntu_py3.md
Ubuntu 14.04 Python 3.4.2 Setup using pyenv and pyvenv

What I did to get Python 3.4.2 on Ubuntu 14.04. The stock version of Python 3 on Ubuntu is 3.4.0. Which is missing some of the best parts! (asyncio, etc). Luckily I discovered pyenv which solved my problem.

Install pyenv

Pyenv (not to be confused with pyvenv) is the Python equivelant of rbenv. It lets you configure which Python environment/version is available per directory, user, or other session variables.

I followed the instructions here to install pyenv in my home directory. Verbatem, those instructions are:

sudo apt-get install git python-pip make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev
@MrJohnsson77
MrJohnsson77 / php-html-css-js-minifier.php
Created March 15, 2016 19:53 — forked from taufik-nurrohman/php-html-css-js-minifier.php
PHP Function to Minify HTML, CSS and JavaScript
<?php
/**
* -----------------------------------------------------------------------------------------
* Based on `https://github.com/mecha-cms/mecha-cms/blob/master/system/kernel/converter.php`
* -----------------------------------------------------------------------------------------
*/
// HTML Minifier
function minify_html($input) {
@MrJohnsson77
MrJohnsson77 / middleware.py
Created February 2, 2016 09:57 — forked from j4mie/middleware.py
Django middleware to log the total number of queries run and query time for every request
from django.db import connection
from django.utils.log import getLogger
logger = getLogger(__name__)
class QueryCountDebugMiddleware(object):
"""
This middleware will log the number of queries run
and the total time taken for each request (with a
status code of 200). It does not currently support
@MrJohnsson77
MrJohnsson77 / README.md
Created January 12, 2016 13:14 — forked from magnetikonline/README.md
Setting Nginx FastCGI response buffer sizes.

Nginx FastCGI response buffer sizes

By default when Nginx starts receiving a response from a FastCGI backend (such as PHP-FPM) it will buffer the response in memory before delivering it to the client. Any response larger than the set buffer size is saved to a temporary file on disk. This process is also explained at the Nginx ngx_http_fastcgi_module page document page.

Since disk is slow and memory is fast the aim is to get as many FastCGI responses passing through memory only. On the flip side we don't want to set an excessively large buffer as they are created and sized on a per request basis (i.e. it's not shared memory).

The related Nginx options are: