Sysctl
Bootloader
Mandatory Access Control
Sandboxing
Root Tweaks
Extra Tweaks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function perc2color(perc) { | |
var r, g, b = 0; | |
if(perc < 50) { | |
r = 255; | |
g = Math.round(5.1 * perc); | |
} | |
else { | |
g = 255; | |
r = Math.round(510 - 5.10 * perc); | |
} |
This is a companion piece to my instructions on building TensorFlow from source. In particular, the aim is to install the following pieces of software
- NVIDIA graphics card driver (v450.57)
- CUDA (v11.0.2)
- cuDNN (v8.0.2.39)
on an Ubuntu Linux system, in particular Ubuntu 20.04.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def make_weights_for_balanced_classes(images, nclasses): | |
count = [0] * nclasses | |
for item in images: | |
count[item[1]] += 1 | |
weight_per_class = [0.] * nclasses | |
N = float(sum(count)) | |
for i in range(nclasses): | |
weight_per_class[i] = N/float(count[i]) | |
weight = [0] * len(images) | |
for idx, val in enumerate(images): |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Ralamb(Optimizer): | |
def __init__(self, params, lr=1e-3, betas=(0.9, 0.999), eps=1e-8, weight_decay=0): | |
defaults = dict(lr=lr, betas=betas, eps=eps, weight_decay=weight_decay) | |
self.buffer = [[None, None, None] for ind in range(10)] | |
super(Ralamb, self).__init__(params, defaults) | |
def __setstate__(self, state): | |
super(Ralamb, self).__setstate__(state) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from typing import Union | |
import torch | |
import numpy as np | |
def percentile(t: torch.tensor, q: float) -> Union[int, float]: | |
""" | |
Return the ``q``-th percentile of the flattened input tensor's data. | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import xmltodict | |
import pandas as pd | |
with open("full_database.xml") as db: | |
doc = xmltodict.parse(db.read()) | |
values = [] | |
for item in doc['drugbank']['drug']: | |
logp = None | |
try: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os, time, sys, subprocess | |
if len(sys.argv) == 2: | |
time.sleep(5) | |
print 'track end' | |
if sys.platform == 'darwin': | |
subprocess.Popen(['say', 'hello']) | |
else: | |
print 'main begin' | |
subprocess.Popen(['python', os.path.realpath(__file__), '0'], close_fds=True) |
NewerOlder