Skip to content

Instantly share code, notes, and snippets.

@wangruohui
wangruohui / Install NVIDIA Driver and CUDA.md
Last active April 23, 2024 02:03
Install NVIDIA Driver and CUDA on Ubuntu / CentOS / Fedora Linux OS
@ammario
ammario / ipint.go
Last active April 20, 2024 12:51
Golang IP <-> int conversion
func ip2int(ip net.IP) uint32 {
if len(ip) == 16 {
return binary.BigEndian.Uint32(ip[12:16])
}
return binary.BigEndian.Uint32(ip)
}
func int2ip(nn uint32) net.IP {
ip := make(net.IP, 4)
binary.BigEndian.PutUint32(ip, nn)
@fernandezpablo85
fernandezpablo85 / git-maven-howto.md
Last active April 16, 2024 17:02
how to create your own maven repository on github

How to create a maven repository for your github project step by step

Clone your project in a separate folder

(note: replace ORGANIZATION and PROJECT)

git clone git clone git@github.com:ORGANIZATION/PROJECT.git my-repository

Cd into it

@sbyx
sbyx / notify-or-do-something-when-an-appliance-like-a-dishwasher-or-washing-machine-finishes.yaml
Last active April 10, 2024 15:09
Home Assistant Blueprint: Notify or do something when an appliance like a dishwasher or washing machine finishes
blueprint:
name: Appliance has finished
description: Do something when an appliance (like a washing machine or dishwasher)
has finished as detected by a power sensor.
domain: automation
input:
power_sensor:
name: Power Sensor
description: Power sensor entity (e.g. from a smart plug device).
selector:
@michaljemala
michaljemala / tls-client.go
Last active April 10, 2024 01:57
SSL Client Authentication Golang sample
package main
import (
"crypto/tls"
"crypto/x509"
"flag"
"io/ioutil"
"log"
"net/http"
)
@Liryna
Liryna / ARMDebianUbuntu.md
Last active April 6, 2024 15:22
Emulating ARM on Debian/Ubuntu

You might want to read this to get an introduction to armel vs armhf.

If the below is too much, you can try Ubuntu-ARMv7-Qemu but note it contains non-free blobs.

Running ARM programs under linux (without starting QEMU VM!)

First, cross-compile user programs with GCC-ARM toolchain. Then install qemu-arm-static so that you can run ARM executables directly on linux

@enricofoltran
enricofoltran / main.go
Last active April 1, 2024 00:17
A simple golang web server with basic logging, tracing, health check, graceful shutdown and zero dependencies
package main
import (
"context"
"flag"
"fmt"
"log"
"net/http"
"os"
"os/signal"
@brutella
brutella / rpi-enable-camera-module.md
Last active February 9, 2024 09:48
How to enable the camera module on a Raspberry Pi

Enable camera module

Edit your /boot/config.txt file and make sure the following lines look like this:

start_x=1             # essential
gpu_mem=128           # at least, or maybe more if you wish
disable_camera_led=1  # optional, if you don't want the led to glow

Load bcm2835-v4l2 module

@carpben
carpben / useFocus.ts
Created August 10, 2019 04:52
useFocus.ts
export const useFocus = () => {
const htmlElRef = useRef<HTMLElement>()
const setFocus = () => {
const currentEl = htmlElRef.current
currentEl && currentEl.focus()
}
return [setFocus, htmlElRef] as const
}
package main
import (
"fmt"
"io"
"os"
)
var path = "/Users/novalagung/Documents/temp/test.txt"