Skip to content

Instantly share code, notes, and snippets.

View fgolemo's full-sized avatar
:shipit:

Florian Golemo fgolemo

:shipit:
View GitHub Profile
@duhaime
duhaime / .block
Last active September 10, 2019 20:01
Visualizing Vicon Streams
height: 450
import pybullet as p
import time
usePhysX = True
if usePhysX:
p.connect(p.PhysX)
p.loadPlugin("eglRendererPlugin")
else:
p.connect(p.GUI)
@chauhan-utk
chauhan-utk / file.md
Created March 10, 2018 13:53
PyTorch replace pretrained model layers

This code snippet shows how we can change a layer in a pretrained model. In the following code, we change all the ReLU activation functions with SELU in a resnet18 model.

import torch
from torchvision import model

resnet18 = model.resnet18(pretrained=True)

def funct(list_mods):
import {Injectable, provide} from 'angular2/core';
import {Observable} from 'rxjs';
const GEOLOCATION_ERRORS = {
'errors.location.unsupportedBrowser': 'Browser does not support location services',
'errors.location.permissionDenied': 'You have rejected access to your location',
'errors.location.positionUnavailable': 'Unable to determine your location',
'errors.location.timeout': 'Service timeout has been reached'
};
@jeasinema
jeasinema / weight_init.py
Last active May 25, 2023 09:32
A simple script for parameter initialization for PyTorch
#!/usr/bin/env python
# -*- coding:UTF-8 -*-
import torch
import torch.nn as nn
import torch.nn.init as init
def weight_init(m):
'''

Raspberry Pi VPN Router

This is a quick-and-dirty guide to setting up a Raspberry Pi as a "router on a stick" to ExpressVPN.

This is adapted from SuperJamie's gist.

Requirements

I used a Raspberry Pi 3 - seems like the extra speed may be useful for running VPN.

@todbot
todbot / circuitpyton_disable_usb_boot.py
Last active August 27, 2023 10:11
Disable USB devices in CircuitPython in boot.py
# circuitpython_disable_usb_boot.py
# Turn on/off certain USB features based on touching RX & TX pins
# Squeeze TX & RX pins with fingers to enable CIRCUITPY & REPL
# Otherwise, they are turned off
# CircuitPython 7.x only
# Rename this as "boot.py" in your CIRCUITPY drive on a QT PY
# @todbot 17 May 2021
import time
import board
@tekemperor
tekemperor / rpi3-bt-keyboard.txt
Created July 22, 2016 01:46
Connect Apple Wireless Keyboard to Raspberry Pi 3 in Raspbian
sudo service bluetooth status # Verify bluetooth is active.
sudo bluetoothctl # Lauch bluetooth subshell.
agent on # [No idea what this does.]
default-agent # [No idea what this does.]
scan on # Displays a list of available devices.
pair XX:XX:XX:XX:XX:XX # This prepares a potential connection, the X's represent your device ID
# A "PIN code" will be displayed, type it on the keyboard and press "enter".
trust XX:XX:XX:XX:XX:XX # Adds device to trusted devices, this survives reboot.
connect XX:XX:XX:XX:XX:XX # Connect to the device now.
exit # Return to previous shell.
@sbarratt
sbarratt / torch_jacobian.py
Created May 9, 2019 19:40
Get the jacobian of a vector-valued function that takes batch inputs, in pytorch.
def get_jacobian(net, x, noutputs):
x = x.squeeze()
n = x.size()[0]
x = x.repeat(noutputs, 1)
x.requires_grad_(True)
y = net(x)
y.backward(torch.eye(noutputs))
return x.grad.data
@stonehippo
stonehippo / wio-terminal-circuitpython.md
Last active February 13, 2024 13:32
Using CircuitPython modules to work with the Seeed Wio Terminal

Seeed Wio Terminal Circuitpython Modules

note: All of these examples have been tested with the latest version of CircuitPython, which as of this writing was 7.2.4. Some of these examples may require tweaks in older or later versions, due to change in the drivers.

The Seeed Wio Terminal is a nifty connected device development kit. Built around a SAMD51 Cortex-M4 microcontroller and a Realtek RTL8720DN for WiFi and Bluetooth, plus an integrated display and a collection of handy sensors, the Wio Terminal is a great platform for IoT and smart device development.

One of the nice things about the Wio Terminal is the number of options available for developement platforms. You can choose the long-time hardware hacking favorite Arudino, MicroPython or Ardupy, an interesting blend of MicroPython and Arduino. And there's support for my