Skip to content

Instantly share code, notes, and snippets.

@bogdan-kulynych
bogdan-kulynych / install-cuda-10-bionic.sh
Last active October 17, 2024 23:17
Install CUDA 10 on Ubuntu 18.04
# WARNING: These steps seem to not work anymore!
#!/bin/bash
# Purge existign CUDA first
sudo apt --purge remove "cublas*" "cuda*"
sudo apt --purge remove "nvidia*"
# Install CUDA Toolkit 10
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-repo-ubuntu1804_10.0.130-1_amd64.deb
@kmorel
kmorel / birthdays.py
Created September 15, 2013 01:13
A Python script to estimate the probabilities of the birthday problem (http://en.wikipedia.org/wiki/Birthday_problem) for subgroups of size 2, 3, 4, 5, and 6 that have the same birthday.
import random
maxBirthdays = 6
numDays = 365
numTrials = 100000
maxGroupSize = 1000
def BirthdayExperiment():
birthdays = [0] * numDays
numToDuplicates = {}
@destan
destan / text2png.py
Last active January 10, 2024 06:32
Python text to image (png) conversion with automatic new line calculation
# coding=utf8
import PIL
from PIL import ImageFont
from PIL import Image
from PIL import ImageDraw
def text2png(text, fullpath, color = "#000", bgcolor = "#FFF", fontfullpath = None, fontsize = 13, leftpadding = 3, rightpadding = 3, width = 200):
REPLACEMENT_CHARACTER = u'\uFFFD'
NEWLINE_REPLACEMENT_STRING = ' ' + REPLACEMENT_CHARACTER + ' '