Skip to content

Instantly share code, notes, and snippets.

View fgolemo's full-sized avatar
:shipit:

Florian Golemo fgolemo

:shipit:
View GitHub Profile
@robert-mcdermott
robert-mcdermott / ollama-emb-cosine-dot.py
Created February 22, 2024 07:47
ollama embeddings cosine similarity and dot product example
# pip install scikit-learn numpy ollama
import ollama
import numpy as np
from sklearn.metrics.pairwise import cosine_similarity
text1 = ollama.embeddings(model='nomic-embed-text', prompt='The sky is blue because of rayleigh scattering')
text2 = ollama.embeddings(model='nomic-embed-text', prompt='The sky is cloudy and grey today')
vec1 = np.array(text1['embedding']).reshape(1, -1)
vec2 = np.array(text2['embedding']).reshape(1, -1)
@stonehippo
stonehippo / wio-terminal-circuitpython.md
Last active December 1, 2024 19:15
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

@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
@fjebaker
fjebaker / zotero-webdav.md
Last active November 6, 2025 18:07
How to setup a private Zotero sync using WebDAV and Docker.

Zotero Sync with WebDAV and Docker

Zotero is another tool for keeping track of research papers, except Zotero does much more than that: the open source software ships with a browser extension which allows you to add almost anything (papers, book, videos, wikipedia pages) to your library with a single click, keep notes and additional resources close at hand, and export citations in a whole mass of different formats.

In addition to all that, Zotero also comes with a cloud storage sync, so you can back up all of your library and sync it on other machines.

Zotero provides a WebDAV client so that you can host your own, however this isn't particuarly well documented to date.

  • Requisites:

You'll need Docker and a Zotero login (file sync is prevented without a login, so you can create a throw away one if so desired).

@shubhamwagh
shubhamwagh / TexturedMeshSteps.md
Last active September 25, 2025 22:55
Steps to create textured mesh from point cloud using Meshlab

Steps to create Textured Mesh from Point Cloud using Meshlab

Get your PointCloud into MeshLab

  • Import the pointcloud file in ".ply" file format in Meshlab. Before importing make sure you do some pre-processing / cleaning on point cloud so as to ease the process of meshing.

Point Cloud Simplification and Normals Computation

  • Next we need to reduce the number of point samples for smooth meshing.
    • So go to Filters -> Point Set -> Point Cloud Simplification. Enter Number of samples circa 5% of original number of points. Make sure Best Sample Heuristic is checked.
  • After point cloud simplification, make sure to select Simplified point cloud in the Show Layer Dialog on the right hand side. If not visible, it can be opened by navigating to View -> Show Layer Dialog. Now we need to compute normals for point set.
  • So go to Filters -> Point Set -> Compute normals for point sets . Enter Neighbour num between 10 - 100. Initially try with 10 and
@duhaime
duhaime / .block
Last active September 10, 2019 20:01
Visualizing Vicon Streams
height: 450
@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
@Gustavo-Kuze
Gustavo-Kuze / force-ctrl-c-v.md
Last active November 9, 2025 20:48
Enable copy and paste in a webpage from the browser console
javascript:(function(){
  allowCopyAndPaste = function(e){
  e.stopImmediatePropagation();
  return true;
  };
  document.addEventListener('copy', allowCopyAndPaste, true);
  document.addEventListener('paste', allowCopyAndPaste, true);
  document.addEventListener('onpaste', allowCopyAndPaste, true);
})(); 
import pybullet as p
import time
usePhysX = True
if usePhysX:
p.connect(p.PhysX)
p.loadPlugin("eglRendererPlugin")
else:
p.connect(p.GUI)
@jeasinema
jeasinema / weight_init.py
Last active November 22, 2024 07:17
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):
'''