Skip to content

Instantly share code, notes, and snippets.

View FrancescoSaverioZuppichini's full-sized avatar
🧸
Focusing

Francesco Saverio Zuppichini FrancescoSaverioZuppichini

🧸
Focusing
  • roboflow
  • Lugano, Switzerland
View GitHub Profile
@morrolinux
morrolinux / linux-full-desktop-container.md
Last active January 30, 2024 14:21
Run a full linux desktop in a container

In the following gist I'm going to guide you through the process of installing and booting an entire linux distribution with full desktop environment just like you would have with a classical VM, but with much better performance and much worse isolation :)

The reason why I did this was mainly because it's cool, but also to test new distros with decent graphics performance without actually booting them on my PC.

If you "try this at home" just keep in mind a container is not as secure as a VM, and some of the option we're going to explore will weaken container isolation from "a bit risky" to "totally unsafe" depending on what you choose.

Also, we're going to use systemd-nspawn for containers as it's probably the best fit for our use case and can also boot any linux partition without needing to prepare an apposite container image.

Less go!

@Mahedi-61
Mahedi-61 / cuda_11.8_installation_on_Ubuntu_22.04
Last active April 19, 2024 02:17
Instructions for CUDA v11.8 and cuDNN 8.9.7 installation on Ubuntu 22.04 for PyTorch 2.1.2
#!/bin/bash
### steps ####
# Verify the system has a cuda-capable gpu
# Download and install the nvidia cuda toolkit and cudnn
# Setup environmental variables
# Verify the installation
###
### to verify your gpu is cuda enable check
@dmmiller612
dmmiller612 / tensorflow_json.py
Created December 11, 2017 15:58
Tensorflow Graph and weights to json and back for training
import tensorflow as tf
import numpy as np
from google.protobuf import json_format
import json
np.random.seed(12345)
def tensorflow_get_weights():
"""
@starhopp3r
starhopp3r / main.py
Last active September 25, 2017 07:55
import numpy as np
import os
class NeuralNetwork:
def __init__(self):
# Our training data
self.X = np.array([[0, 0, 1], [1, 1, 1], [1, 0, 1], [0, 1, 1]])
self.y = np.transpose(np.array([[0, 1, 1, 1]]))
# Seed random number generator to produce the same
@peterroelants
peterroelants / mnist_estimator.py
Last active February 14, 2024 11:26
Example using TensorFlow Estimator, Experiment & Dataset on MNIST data.
"""Script to illustrate usage of tf.estimator.Estimator in TF v1.3"""
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data as mnist_data
from tensorflow.contrib import slim
from tensorflow.contrib.learn import ModeKeys
from tensorflow.contrib.learn import learn_runner
# Show debugging output
@nicolasdespres
nicolasdespres / iter_shuffle_batch_tensors.py
Created March 8, 2017 08:12
Iterate of shuffled batch of tensors slices.
class iter_shuffle_batch_tensors(Iterator):
"""Combine `iter_tensors_slice` and `iter_shuffle_batch_range`.
Args:
See `iter_tensors_slice` and `iter_shuffle_batch_range`.
Output:
See `iter_shuffle_batch_range`.
"""
@iambrian
iambrian / OpenAI-Gym_setup.md
Last active November 13, 2020 21:12
OpenAI gym tutorial

Getting Setup: Follow the instruction on https://gym.openai.com/docs

git clone https://github.com/openai/gym
cd gym
pip install -e . # minimal install

Basic Example using CartPole-v0:

@tuxdna
tuxdna / pi.py
Last active April 13, 2024 04:02
Policy Iteration in Python
#!/usr/bin/env python
# coding=utf-8
import numpy as np
"""
1: Procedure Policy_Iteration(S,A,P,R)
2: Inputs
3: S is the set of all states
4: A is the set of all actions
5: P is state transition function specifying P(s'|s,a)
@yrevar
yrevar / imagenet1000_clsidx_to_labels.txt
Last active April 17, 2024 22:50
text: imagenet 1000 class idx to human readable labels (Fox, E., & Guestrin, C. (n.d.). Coursera Machine Learning Specialization.)
{0: 'tench, Tinca tinca',
1: 'goldfish, Carassius auratus',
2: 'great white shark, white shark, man-eater, man-eating shark, Carcharodon carcharias',
3: 'tiger shark, Galeocerdo cuvieri',
4: 'hammerhead, hammerhead shark',
5: 'electric ray, crampfish, numbfish, torpedo',
6: 'stingray',
7: 'cock',
8: 'hen',
9: 'ostrich, Struthio camelus',
@kastnerkyle
kastnerkyle / painless_q.py
Last active August 18, 2023 09:32
Painless Q-Learning Tutorial implementation in Python http://mnemstudio.org/path-finding-q-learning-tutorial.htm
# Author: Kyle Kastner
# License: BSD 3-Clause
# Implementing http://mnemstudio.org/path-finding-q-learning-tutorial.htm
# Q-learning formula from http://sarvagyavaish.github.io/FlappyBirdRL/
# Visualization based on code from Gael Varoquaux gael.varoquaux@normalesup.org
# http://scikit-learn.org/stable/auto_examples/applications/plot_stock_market.html
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.collections import LineCollection