Skip to content

Instantly share code, notes, and snippets.

@grinya007
grinya007 / MIP.mps
Created July 3, 2023 21:41
An MPS file that causes HiGHS solver to fail sporadically
NAME
ROWS
N Obj
E r0
E r1
E r2
E r3
E r4
E r5
E r6
@grinya007
grinya007 / work_queue.rs
Created February 7, 2022 14:50 — forked from NoraCodes/work_queue.rs
An example of a parallel work scheduling system using only the Rust standard library
// Here is an extremely simple version of work scheduling for multiple
// processors.
//
// The Problem:
// We have a lot of numbers that need to be math'ed. Doing this on one
// CPU core is slow. We have 4 CPU cores. We would thus like to use those
// cores to do math, because it will be a little less slow (ideally
// 4 times faster actually).
//
// The Solution:
git clone https://github.com/grinya007/recomlive-docker.git
cd recomlive-docker
make
make start
import numpy as np
from sklearn.preprocessing import normalize
from scipy.sparse import lil_matrix
np.set_printoptions(precision=2)
m = lil_matrix([[1,0,0,0,1,0,0],[1,1,1,0,0,0,0],[0,0,1,0,0,1,0],[0,0,0,1,0,0,0],[0,0,0,0,0,0,1]])
m.todense()
# matrix([[1, 0, 0, 0, 1, 0, 0],
# [1, 1, 1, 0, 0, 0, 0],
# [0, 0, 1, 0, 0, 1, 0],
# [0, 0, 0, 1, 0, 0, 0],
import numpy as np
from sklearn.preprocessing import normalize
np.set_printoptions(precision=2)
m = np.matrix([[1,0,0,0,1,0,0],[1,1,1,0,0,0,0],[0,0,1,0,0,1,0],[0,0,0,1,0,0,0],[0,0,0,0,0,0,1]])
m
# matrix([[1, 0, 0, 0, 1, 0, 0],
# [1, 1, 1, 0, 0, 0, 0],
# [0, 0, 1, 0, 0, 1, 0],
# [0, 0, 0, 1, 0, 0, 0],
# [0, 0, 0, 0, 0, 0, 1]])
@grinya007
grinya007 / gist:39ebe50afad30b1b6b182e1a0daed385
Created March 27, 2019 19:52
recommend.py, sample output
Type in movie title (q to quit): future back
title
0 Back to the Future (1985)
1 Back to the Future Part II (1989)
2 Back to the Future Part III (1990)
3 Ivan Vasilievich: Back to the Future (Iv ... (1973)
4 Way Back, The (2010)
master
Parallel workers: avg 1.75, max 6
Timing Summary
Validation : 18.63 seconds
Steps
Pre-processing : 81.24 seconds
Mosek Optimisation : 28.80 seconds
Post-processing : 9.01 seconds
Load raw results : 27.58 seconds
Results Engine : 47.30 seconds

Installing Debian Jessie on MacBook Pro Retina

Things you need:
  • MacBook Pro
  • USB Flash Drive with at least 4GB space
Create a bootable USB of Debian Jessie:
  1. Download the latest image of Debian Jessie, weekly release. The first DVD, gives you a bare minimun debian install. The second contains less popular stuff. If you install multiple, concatenate the iso's by cat /path/to/disk1.iso /path/to/disk2.iso > combined.iso.