Skip to content

Instantly share code, notes, and snippets.

@douglasmakey
douglasmakey / sender.go
Last active June 7, 2024 15:02
Golang - send an email with attachments.
package main
import (
"bytes"
"encoding/base64"
"fmt"
"io/ioutil"
"mime/multipart"
"net/smtp"
"os"
@marshyon
marshyon / main.go
Last active September 20, 2023 05:59
Golang badger db using GOB to serialise object data into badger fields
/*
*
* Golang badger db using GOB to serialize object data into badger fields
*
* Golang has its very own serializer / deserializer - Go Object (gob) so why not use it where data passed is entirely within a Go
* application ?
*
* JSON or some other text based solution could be used but gob might be faster.
*
* A gob encoder accepts the type bytes.Buffer to encode data to, so to write this to Badger, which accepts the type byte
@mrbar42
mrbar42 / README.md
Last active July 6, 2024 23:08
bash scripts to create VOD HLS stream with ffmpeg almighty (tested on Linux and OS X)

running:

bash create-vod-hls.sh beach.mkv

will produce:

    beach/
      |- playlist.m3u8
 |- 360p.m3u8
@davispuh
davispuh / switch-modules.sh
Last active May 16, 2022 10:47
Switch NVIDIA/nouveau modules
#!/bin/sh
unbind_vtconsoles()
{
for ((i = 0; i < 16; i++))
do
if [ -d "/sys/class/vtconsole/vtcon$i" ]; then
if [ `cat /sys/class/vtconsole/vtcon$i/name | grep -c "frame buffer"` -eq 1 ]; then
while [ `cat /sys/class/vtconsole/vtcon$i/bind` -ne 0 ]; do
@abulte
abulte / bootstrap.sh
Created October 19, 2012 10:21
Build a custom RPI image
#!/bin/bash
# Based on work by Klaus M Pfeiffer at http://blog.kmp.or.at/2012/05/build-your-own-raspberry-pi-image/
# you need to do: "sudo apt-get install binfmt-support qemu qemu-user-static debootstrap kpartx lvm2 dosfstools"
# run with "sudo bootstrap.sh /dev/sd[x]"
echo "Use like: sudo bootstrap.sh /dev/sd[x]"
#deb_mirror="http://ftp.debian.org/debian"
#deb_local_mirror="http://ftp.debian.org/debian"