Skip to content

Instantly share code, notes, and snippets.

import numpy as np
from tqdm import tqdm
from multiprocessing import Pool
file_name = "test.gro" #Should be changed
frame_count = 14 #Should be changed
line_count = 4014 #Should be changed
Lz = 2.84 #Should be changed
Lx = 6.95
@theSage21
theSage21 / demo.py
Last active October 12, 2018 06:47
Tqdm + pool.imap_unordered
from tqdm import tqdm
from multiprocessing import Pool
def myfn(x):
return x ** 2
with Pool() as pool:
args = list(range(1_000_000))
work = pool.imap_unordered(myfn, args, chunksize=100)
import requests
name = 'tfidf_benchmark'
contest = 'marco-search'
fpath = 'output'
files = {"upload": open(fpath, 'rb')}
url = 'https://models.clapresearch.com/api/submit'
requests.post(url, data={"user": name, "contest": contest},
@theSage21
theSage21 / sc.bash
Created July 10, 2018 08:25
Vim + Covim + python 3
sudo apt install libncurses5-dev libgnome2-dev libgnomeui-dev \
libgtk2.0-dev libatk1.0-dev libbonoboui2-dev \
libcairo2-dev libx11-dev libxpm-dev libxt-dev python-dev \
python3-dev ruby-dev lua5.1 liblua5.1-dev libperl-dev git
sudo apt remove vim vim-runtime gvim
git clone https://github.com/vim/vim.git
cd vim/src

title: A Rainforest in Machine Learning author: Arjoonn Sharma @ CLAP Research patat: incrementalLists: true ...

gg

@theSage21
theSage21 / goldrush.py
Last active May 30, 2018 09:53
High load simulator based on aiohttp
import aiohttp
import asyncio
import async_timeout
from tqdm import tqdm
TIMEOUT_LIMIT = 50
async def _get(url, json, pbar):
async with aiohttp.ClientSession() as session:
for _ in range(100):
'''Trains a simple convnet on the MNIST dataset.
Gets to 99.25% test accuracy after 12 epochs
(there is still a lot of margin for parameter tuning).
16 seconds per epoch on a GRID K520 GPU.
'''
import os
from __future__ import print_function
import keras
import asyncio
import aiohttp
import async_timeout
headers = {}
links = [] # TODO: Populate this somehow with urls
done = asyncio.Queue()
dashboard "Food":
- h1 text: Food
- h2 text: By caloric content
- 2 columns:
- attr:query: '[to_entries | .[] | {"component": "rows", "data": [
{"component": "text", "args": {"tagName": "h3"}, "data": .key},
{"component": "chart", "args": {"type": "line"}, "data": {"columns": .value}}
]}]'
- data: https://gist.githubusercontent.com/theSage21/9ca3a5b55ec324599d1baea229c19e27/raw/e81c3109a2c72ad5d718f18e846d6044022e91d7/data.json
{
"Bananas": [1,2,3, 4, 5],
"Tofu" : [1, 1.5, 3],
}