Skip to content

Instantly share code, notes, and snippets.

@raphiz
raphiz / nsupdate.sh
Last active February 2, 2020 12:53
Update script for nsupdate.info (For Synology NAS systems)
#!/usr/bin/env sh
DOMAIN="domain.nsupdate.info"
TOKEN="MYTOKEN"
# Evaluate the current remote IP and the one that is currently registerd
CURRENT=$(curl -s https://ipv4.nsupdate.info/myip)
SAVED=$(python2 -c "import socket; print socket.gethostbyname('$DOMAIN')")
LOGFILE=$( cd "$( dirname "${0}" )" && pwd )/log.txt
TEMPFILE=$( cd "$( dirname "${0}" )" && pwd )/tmp
@yi
yi / gist:01e3ab762838d567e65d
Created July 24, 2014 18:52
lua hex <= => string
function string.fromhex(str)
return (str:gsub('..', function (cc)
return string.char(tonumber(cc, 16))
end))
end
function string.tohex(str)
return (str:gsub('.', function (c)
return string.format('%02X', string.byte(c))
end))
@walkerjeffd
walkerjeffd / Synology-Diskstation-Git.md
Last active November 5, 2024 17:15
Instructions for setting up git server on Synology Diskstation

Configure Synology NAS as Git Server

Instructions for setting up a git server on a Synology NAS with Diskstation. Specifically, I am using a DS414 with DSM 5.0.

Set Up User and Folder

  • Create user gituser via Diskstation interface (with File Station and WebDAV privilages)
  • Add new shared folder called git (located at /volume1/git) with read/write access for gituser and admin. This folder will hold all the repos.
  • Install Git Server package via Diskstation
@dopiaza
dopiaza / slackpost
Created September 5, 2013 12:33
Post a message to a Slack channel
#!/bin/bash
# Usage: slackpost <token> <channel> <message>
# Enter the name of your slack host here - the thing that appears in your URL:
# https://slackhost.slack.com/
slackhost=PUT_YOUR_HOST_HERE
token=$1
@stuby
stuby / rPrint example.txt
Created April 23, 2013 17:54
This is a handy recursive data printer.
> rPrint({first={true,1.3,"abc",{1,2,5}},22,33,last={nil,5},2},nil,"Junk")
Junk table
Junk [1] number 22
Junk [2] number 33
Junk [3] number 2
Junk [last] table
Junk [last] [2] number 5
Junk [first] table
Junk [first] [1] boolean true
Junk [first] [2] number 1.3
@Thinkscape
Thinkscape / smstools-utf8-to-ucs2.sh
Created March 27, 2012 11:28
SMSTools support for sending UTF-8 SMS messages.
#!/bin/bash
#
# This script converts SMS encoded with UTF-8 to UCS2 format expected by smsd.
# To use it, edit your /etc/smsd.conf and add the following line:
#
# checkhandler = /path/to/smstools-utf8-to-ucs2.sh
#
# When creating a new message in /var/spool/outgoing/, add the following header line:
#
# Alphabet: UTF-8
@funkfinger
funkfinger / Makefile
Created April 27, 2011 02:13
My AVR ATTiny85 Makefile
DEVICE = attiny85
CLOCK = 1000000
PROGRAMMER = -c usbtiny
OBJECTS = main.o
FUSES = -U lfuse:w:0x62:m -U hfuse:w:0xdf:m -U efuse:w:0xff:m
# generated by http://www.engbedded.com/fusecalc/
AVRDUDE = avrdude $(PROGRAMMER) -p $(DEVICE)
COMPILE = avr-gcc -Wall -Os -DF_CPU=$(CLOCK) -mmcu=$(DEVICE)