Skip to content

Instantly share code, notes, and snippets.

@tchiavegatti
tchiavegatti / check_version.py
Last active November 15, 2021 20:57
[Check python version on a Jupyter notebook] #jupyter
# Check version runing on Jupyter notebook
from platform import python_version
print(python_version())
# Check version inside your Python program
import sys
print(sys.version)
# Check version in command line or shell
python --version
@harisankarh
harisankarh / vw_test.py
Last active September 28, 2018 21:15
vowpal wabbit test
import os
import random as rand
iters = 1000
actual_threshold = 70
for i in range(iters):
score_sampled = rand.randint(0,100)
get_prob_command = " echo \" | f1:{} \" | netcat localhost 26542".format(score_sampled)
@IAmSuyogJadhav
IAmSuyogJadhav / Transparent drawings in OpenCV.py
Created July 10, 2018 09:41
Add transparency to rectangles, circles, polgons, text or any shape drawn in OpenCV.
import cv2
image = cv2.imread('test.jpg')
overlay = image.copy()
x, y, w, h = 10, 10, 10, 10 # Rectangle parameters
cv2.rectangle(overlay, (x, y), (x+w, y+h), (0, 200, 0), -1) # A filled rectangle
alpha = 0.4 # Transparency factor.
@Mukei
Mukei / conda_environment_rename.sh
Created November 30, 2017 07:01
How to rename a conda environment (workaround)
#One workaround is to create clone environment, and then remove original one:
#(remember about deactivating current environment with deactivate on Windows and source deactivate on macOS/Linux)
conda create --name new_name --clone old_name --offline #use --offline flag to disable the redownload of all your packages
conda remove --name old_name --all # or its alias: `conda env remove --name old_name`
#There are several drawbacks of this method:
# time consumed on copying environment's files,
# temporary double disk usage.
@pachadotdev
pachadotdev / 00-install-intel-mkl-64bit
Last active February 4, 2021 07:59
Install Intel MKL (64 bit) on Ubuntu 17.10
# Option 1: Use apt-get
# keys taken from https://software.intel.com/en-us/articles/installing-intel-free-libs-and-python-apt-repo
cd ~/GitHub/r-with-intel-mkl/
wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2019.PUB
apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS-2019.PUB
sudo sh -c 'echo deb https://apt.repos.intel.com/mkl all main > /etc/apt/sources.list.d/intel-mkl.list'
sudo apt-get update && sudo apt-get install intel-mkl-64bit
@1duo
1duo / centos.install.boost.md
Last active April 4, 2024 18:39
Install Boost library from source on CentOS 7.

Download Boost Library: http://www.boost.org (Choose the expected version)

wget https://cfhcable.dl.sourceforge.net/project/boost/boost/1.54.0/boost_1_54_0.tar.gz
wget https://phoenixnap.dl.sourceforge.net/project/boost/boost/1.58.0/boost_1_58_0.tar.gz
wget https://dl.bintray.com/boostorg/release/1.64.0/source/boost_1_64_0.tar.gz
wget https://dl.bintray.com/boostorg/release/1.65.1/source/boost_1_65_1.tar.gz
wget https://dl.bintray.com/boostorg/release/1.67.0/source/boost_1_67_0.tar.gz
wget https://dl.bintray.com/boostorg/release/1.68.0/source/boost_1_68_0.tar.gz
wget https://dl.bintray.com/boostorg/release/1.69.0/source/boost_1_69_0.tar.gz
@bsodmike
bsodmike / README.md
Last active March 13, 2023 05:04
OC Nvidia GTX1070s in Ubuntu 16.04LTS for Ethereum mining

Following mining and findings performed on EVGA GeForce GTX 1070 SC GAMING Black Edition Graphics Card cards.

First run nvidia-xconfig --enable-all-gpus then set about editing the xorg.conf file to correctly set the Coolbits option.

# /etc/X11/xorg.conf
Section "Device"
    Identifier     "Device0"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
@jadhavj
jadhavj / .gitignore
Last active July 19, 2021 13:28
.gitignore for Scala, SBT with IntelliJ
# Created by Jayesh J.
*.class
*.log
*.iml
*.ipr
*.iws
.idea
out
.cache/
anonymous
anonymous / shapedwindow.py
Created February 9, 2017 18:58
#!/usr/bin/env python
# A simple demonstration of using cairo to shape windows.
# Natan 'whatah' Zohar
import gtk
import math
class ShapedGUI:
def __init__(self):
self.window = gtk.Window()
self.window.show() # We show here so the window gets a border on it by the WM
@ssokolow
ssokolow / x11_watch_active_window.py
Last active February 6, 2024 22:50
python-xlib example which reacts to changing the active window
#!/usr/bin/env python
"""python-xlib example which reacts to changing the active window/title.
Requires:
- Python
- python-xlib
Tested with Python 2.x because my Kubuntu 14.04 doesn't come with python-xlib
for Python 3.x.