Skip to content

Instantly share code, notes, and snippets.

@senisioi
senisioi / Towards the Internet as a Public Infrastructure.md
Last active December 19, 2023 16:53
Towards the Internet as a Public Infrastructure

Towards the Internet as a Public Infrastructure

A Protocol of Fairness

Additive Increase Multiplicative Decrease by TCP Reno. The chainsaw graph illustrates how a node renounces its network resource usage once it identifies congestion.

I would like to start this short essay with a metaphor from the Internet. It’s about a way of allocating resources (bandwidth) in a fair manner so that everyone (both home-users and large organizations) can use the network.

@senisioi
senisioi / ghid
Last active March 14, 2022 13:22
Ghid de adnotare cu exemple
******************************
Ner tag type: PERSON:
PERSON - proper nouns, including common nouns or pronouns if they refer to a person. (e.g. 'sister')
-> Ion Grigorescu
-> președintele
-> persoane
-> Președintele
-> Dumnezeu
-> oameni
-> copii
@senisioi
senisioi / install_docker_compose.sh
Created February 23, 2022 18:05
Install docker-compose without root
# /bin/bash
mkdir -p $HOME/bin && \
curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o $HOME/bin/docker-compose && \
chmod +x $HOME/bin/docker-compose &&
echo 'export PATH=$HOME/bin:$PATH' >> ~/.bashrc && \
bash
'''Raw script to crawl and pull github classroom repos when the classroom assistant hangs.
'''
import os
from bs4 import BeautifulSoup as BfSp
import requests
def dump_to_file(fis, content):
with open(fis, 'w') as fout:
fout.write(content)
'''
ugly but effective for downloading archive books
here it's for Toward a theory of instruction, Jermoe Bruner
'''
import requests
h = {"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
"Accept-Encoding": "gzip, deflate, br",
"Accept-Language": "en-US,en;q=0.9,he;q=0.8,ro;q=0.7",
export USER_TO_INSTALL=student
sudo useradd -m ${USER_TO_INSTALL} && \
sudo mkdir -p /home/${USER_TO_INSTALL}/.ssh && \
sudo cp ~/.ssh/authorized_keys /home/${USER_TO_INSTALL}/.ssh && \
sudo chown -R ${USER_TO_INSTALL}:${USER_TO_INSTALL} /home/${USER_TO_INSTALL}/.ssh && \
sudo chmod 0700 /home/${USER_TO_INSTALL}/.ssh && \
sudo chmod 0600 /home/${USER_TO_INSTALL}/.ssh/authorized_keys && \
sudo usermod -aG docker ${USER_TO_INSTALL} && \
@senisioi
senisioi / tutorial.md
Last active November 13, 2018 12:22
tutorial.md

Build a server, start a community

$ echo "Starting from absolute scratch..."

Ingredients:

  • hardware: computer, public ip connection say 89.133.41.2 (to be accessible from any place in the world)
  • software: ubuntu (in isiZulu meaning "I am what I am because of who we all are.") operating system, some text editor, vim, ssh, cowsay, fortune
def train(model, config)
positive = config.get('positive', [])
negative = config.get('negative', [])
ood_path = []
ood_label = None
data, _ = get_data_for_config(positive, negative, ood_path, ood_label)
run_name = config.get('name', get_normal_names(positive + negative))
run_mode = config.get('mode', None)
#/bin/bash
cd $HOME
wget http://wingware.com/pub/wingide-personal/6.0.10/wingide-personal-6.0.10-1-x86_64-linux.tar.bz2 && \
tar -xvf wingide-personal-6.0.10-1-x86_64-linux.tar.bz2 && \
mkdir -p $HOME/wingide && \
cd wingide-personal-6.0.10-1-x86_64-linux && \
python wing-install.py --winghome `readlink -f $HOME/wingide` --bin-dir `readlink -f $HOME/wingide` && \
echo "export PATH=$PATH:$HOME/wingide" | tee -a $HOME/.bashrc && \
exit 0