Skip to content

Instantly share code, notes, and snippets.

Avatar

Luca Capra muka

View GitHub Profile
View useFocus.ts
export const useFocus = () => {
const htmlElRef = useRef<HTMLElement>()
const setFocus = () => {
const currentEl = htmlElRef.current
currentEl && currentEl.focus()
}
return [setFocus, htmlElRef] as const
}
@brutella
brutella / rpi-enable-camera-module.md
Last active Sep 10, 2021
How to enable the camera module on a Raspberry Pi
View rpi-enable-camera-module.md

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

@enricofoltran
enricofoltran / main.go
Last active Sep 23, 2021
A simple golang web server with basic logging, tracing, health check, graceful shutdown and zero dependencies
View main.go
package main
import (
"context"
"flag"
"fmt"
"log"
"net/http"
"os"
"os/signal"
@Prasad9
Prasad9 / annotation.xml
Created Nov 6, 2017
A sample XML annotation file based on Pascal VOC format.
View annotation.xml
<annotation>
<folder>GeneratedData_Train</folder>
<filename>000001.png</filename>
<path>/my/path/GeneratedData_Train/000001.png</path>
<source>
<database>Unknown</database>
</source>
<size>
<width>224</width>
<height>224</height>
@douglasrizzo
douglasrizzo / tf_obj_tutorial.md
Last active Sep 24, 2021
TensorFlow Object Detection Model Training
View tf_obj_tutorial.md
@wangruohui
wangruohui / Install NVIDIA Driver and CUDA.md
Last active Sep 25, 2021
Install NVIDIA Driver and CUDA on Ubuntu / CentOS / Fedora Linux OS
View Install NVIDIA Driver and CUDA.md
@ammario
ammario / ipint.go
Created Jun 5, 2016
Golang ip <-> int conversion
View ipint.go
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)
@tpokorra
tpokorra / lxc-pi
Created Jan 20, 2016
lxc container Raspberry Pi
View lxc-pi
#!/bin/bash
#
# lxc: linux Container library
# Authors:
# Original Debian:
# Daniel Lezcano <daniel.lezcano@free.fr>
# Changes for Raspberry Pi by:
# Oliver Heller <oliver@d24m.de>
@austinjp
austinjp / Wordpress-inside-LXC.md
Last active Oct 9, 2020
An *unprivileged* LXC container dedicated to running Wordpress
View Wordpress-inside-LXC.md

What and why

Create an unprivileged Linux container (LXC) dedicated to running Wordpress websites.

If you install Wordpress regularly on Linux you can instead simply clone this container.

The Wordpress installation is nothing fancy. It's not multi-site, it's not SSL enabled by default, or anything like that. Just a plain bog-standard Wordpress installation serving a single domain.

Warning!

View golang-create-read-write-delete-file.go
package main
import (
"fmt"
"io"
"os"
)
var path = "/Users/novalagung/Documents/temp/test.txt"