Skip to content

Instantly share code, notes, and snippets.

@streetturtle
streetturtle / sp
Last active March 29, 2024 08:53 — forked from wandernauta/sp
sp is a command-line client for Spotify's dbus interface. Play, pause, skip and search tracks from the comfort of your command line.
#!/bin/bash
#
# This is sp, the command-line Spotify controller. It talks to a running
# instance of the Spotify Linux client over dbus, providing an interface not
# unlike mpc.
#
# Put differently, it allows you to control Spotify without leaving the comfort
# of your command line, and without a custom client or Premium subscription.
#
@owencm
owencm / blob-to-image.js
Created January 12, 2019 18:01
Convert a blob to an image with JavaScript (e.g. to render blob to canvas)
const blobToImage = (blob) => {
return new Promise(resolve => {
const url = URL.createObjectURL(blob)
let img = new Image()
img.onload = () => {
URL.revokeObjectURL(url)
resolve(img)
}
img.src = url
})

I run this on Intel CPU with integrated GPU with suppport for face recognision - i3-8100T . Your CPU need to support JPEG encoding: https://en.wikipedia.org/wiki/Intel_Quick_Sync_Video#Hardware_decoding_and_encoding . The best choice is a processor from the Coffee Lake series.

To run kernel with GPU virtualization you need to boot with params:

init_on_alloc=0 i915.enable_gvt=1 kvm.ignore_msrs=1 intel_iommu=on i915.enable_guc=0

Next, you need this hook to libvirt,

Variables:

@x-yuri
x-yuri / mongo + docker.md
Last active March 29, 2024 08:47
mongo + docker

mongo + docker

mongo >= 6: init-mongo.js + MONGO_INITDB_DATABASE in .env-mongo
mongo < 6: init-mongo.sh + no MONGO_INITDB_DATABASE in .env-mongo

.env:

MONGO_USER=user
MONGO_PASSWORD=userpasswd
@chranderson
chranderson / nvmCommands.js
Last active March 29, 2024 08:46
Useful NVM commands
// check version
node -v || node --version
// list locally installed versions of node
nvm ls
// list remove available versions of node
nvm ls-remote
// install specific version of node
@luke161
luke161 / Singleton.cs
Last active March 29, 2024 08:46
Unity MonoBehaviour Singleton. Base class for creating a singleton in Unity, handles searching for an existing instance, useful if you've created the instance inside a scene. Also handles cleaning up of multiple singleton instances in Awake.
/**
* Singleton.cs
* Author: Luke Holland (http://lukeholland.me/)
*/
using UnityEngine;
public class Singleton<T> : MonoBehaviour where T : MonoBehaviour
{
@ceving
ceving / Web Component for Copyright Years.md
Last active March 29, 2024 08:44
Web Component for Copyright Years
@jfuellert
jfuellert / ScrollableView.swift
Last active March 29, 2024 08:40
A scrollable SwiftUI view, UIScrollView wrapper. ScrollableView lets you read and write content offsets for scrollview in SwiftUI, with and without animations.
import SwiftUI
struct ScrollableView<Content: View>: UIViewControllerRepresentable, Equatable {
// MARK: - Coordinator
final class Coordinator: NSObject, UIScrollViewDelegate {
// MARK: - Properties
private let scrollView: UIScrollView
var offset: Binding<CGPoint>

Intro

A fine marzo 2024 è stata messa online la Piattaforma Unica Nazionale dei punti di ricarica per i veicoli elettrici, in cui sono visualizzabili su mappa o in elenchi - e non anche come dati grezzi e aperti - i punti di ricarica per veicoli elettrici presenti in Italia.

Lo saranno in futuro? Non è dato saperlo, ma è molto probabile che avvenga, perché lo prevedono le norme e lo raccomanda il buon senso.

Accesso dati

Navigando il sito con un browser (vedi immagine), si legge in chiaro che i dati sono esposti tramite API.

@6174
6174 / Random-string
Created July 23, 2013 13:36
Generate a random string in JavaScript In a short and fast way!
//http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript
Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);