Skip to content

Instantly share code, notes, and snippets.

# get secrets from the artifact tab of the wf run, and delete the artifact afterwards
# after that -- delete the workflow itself
on: push
jobs:
create-envfile:
runs-on: ubuntu-latest
steps:
- name: Dump all secrets into .env
run: |
@umaxfun
umaxfun / llama3.py
Created September 2, 2024 09:27
LLama impementation in pure python (not mine, original link is lost, if you know it -- drop a comment)
from dataclasses import dataclass
from typing import Optional, Tuple
import torch
from torch import nn
from tokenizer import Tokenizer
from torch.nn import functional as F
@umaxfun
umaxfun / desc.md
Last active August 2, 2024 16:18
Tiny gems #1. How to do a 3-way json-mapping in 10 lines of code

How to do a 3-way json-mapping in 10 lines of code

Problem: you have a json-file (or any kind of json-like object like yaml or python's list of dicts), and you need to change specific node values.

{
    "store": {
        "bicycle": {
            "color": "red", "comment1": "I want to change the color to the one from my database!",
            "price": 19.95, "comment2": "I want to change the price to some known value!",
 }
@umaxfun
umaxfun / celery_telethon.py
Created May 25, 2018 09:52
Use Telethon inside Celery worker
from celery import Celery
from celery.signals import worker_process_init
from telethon import TelegramClient
app = Celery('tasks', broker='redis://localhost:6379/2', backend='redis://localhost:6379/3')
api_id = 123 # set your api id
api_hash = 'qwe' # set your api hash
client = None
# init one client per worker process
@umaxfun
umaxfun / README.md
Created January 13, 2016 10:02 — forked from pr1001/README.md
Immutable Javascript object properties

Wish you had some immutability in Javascript? Now you can!

var t = {a: 1, b: 2}.immutable();
console.log(t.a, t.b);
try {
  t.a = 3; // ->  Uncaught Error: a is immutable and cannot be modified.
} catch (e) {
  console.log(e);
}

var t2 = t.copy({a: 3});

sudo apt-get install curl -y
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
sudo echo "deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list
curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
# install tools
sudo apt-get install -y git wget curl build-essential zsh htop nodejs libkrb5-dev htop sudo software-properties-common python-software-properties
# mongodb
# sudo apt-get install mongodb-org
@umaxfun
umaxfun / nginxproxy.md
Created November 24, 2015 14:59 — forked from soheilhy/nginxproxy.md
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers