Skip to content

Instantly share code, notes, and snippets.

@ShaRose
ShaRose / alpineUpgradeDiskless.sh
Last active September 10, 2022 22:22
Script for updating Alpine diskless installs to the latest version: without canning it!
#!/bin/bash
echo "Getting last image..."
LastImage="$(curl -s https://dl-cdn.alpinelinux.org/alpine/latest-stable/releases/x86_64/ | sed -n 's/.*"\(alpine-extended-[[:digit:]\.]*-x86_64.iso\)".*/\1/p' | sort -r | head -n 1)"
LastVer="$(echo $LastImage | sed -n 's/alpine-extended-\([[:digit:]\.]*\)-x86_64.iso/\1/p')"
LastMVer="$(echo $LastVer | sed -n 's/\([[:digit:]]*\.[[:digit:]]*\).*/\1/p')"
CurrentVer="$(cat /media/usb/.alpine-release | sed -n 's/alpine-extended-\([[:digit:]\.]*\).*/\1/p')"
CurrentMVer="$(echo $CurrentVer | sed -n 's/\([[:digit:]]*\.[[:digit:]]*\).*/\1/p')"
@ShaRose
ShaRose / gist:0e78fd48ef3b570f7325f99821d18893
Created August 22, 2021 23:41
freepbx extension code for SMS via sip message
[sms-in]
exten => _.,1,NoOp(Inbound SMS dialplan invoked)
exten => _.,n,NoOp(To ${MESSAGE(to)})
exten => _.,n,NoOp(From ${MESSAGE(from)})
exten => _.,n,NoOp(Body ${MESSAGE(body)})
exten => _.,n,Set(ACTUAL_FROM=${MESSAGE(from)})
exten => _.,n,Set(HOST_TO=${CUT(MESSAGE(to),@,2)})
exten => _.,n,Set(NUMBER_TO=${MESSAGE_DATA(X-SMS-To)})
exten => _.,n,Gosub(sms-in,T_${NUMBER_TO},1)
exten => _.,n,Hangup()
@ShaRose
ShaRose / worker.js
Created June 21, 2021 00:24
simple torrent IP checker for Cloudflare Workers
addEventListener('fetch', function(event) {
const { request } = event
const response = handleRequest(request).catch(handleError)
event.respondWith(response)
})
async function handleRequest(request) {
const { method, url } = request
const { host, pathname } = new URL(url)
if(pathname == '/download') {
#! /bin/sh
# Written for EdgeOS, probably works on vyos and vyatta as well.
# Writes full (tar based) backup to /tmp, then uploads it to each of the commit archive locations.
# Doesn't do cycling or anything: Just router-full-backup-2021-02-16.tar.gz fired at where you store commits every whenever
# Things to do if I weren't lazy:
# Make it a package, with its own configuration trees
# Encrypt each backup using public key or private key crypto: your choice!
# Make it cycle backups automatically
from flask import Flask, request, abort, g
from functools import wraps
from uuid import uuid4
from flask_basicauth import BasicAuth
import json
import db
import re
app = Flask(__name__)
@ShaRose
ShaRose / app.py
Created July 22, 2018 23:20 — forked from ColeMundus/app.py
Acme remote DNS api thingy
from flask import Flask, request, abort, g
from functools import wraps
from uuid import uuid4
import json
import db
app = Flask(__name__)
def require_appkey(view_function):
@wraps(view_function)
#!/bin/bash
if [ ! -d "$1" ]; then
echo "Instructions:
./procacls.sh /Path/To/Folder 'user:myuser@domain.path:rwx,group:mygroup@domain.path:rwx'
Outputs * for each record processed."
exit 1
fi
# Maintainer: Brian Bidulock <bidulock@openss7.org>
pkgname=http-parser-git
pkgver=2.7.1.r11.gfd3850c
pkgrel=1
pkgdesc="Parser for HTTP Request/Response written in C"
arch=('i686' 'x86_64' 'armv7h')
url="https://github.com/nodejs/http-parser"
license=('MIT')
depends=('glibc')
# Copyright Joyent, Inc. and other Node contributors. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
[builder@archbuilder http-parser-git]$ git clone https://github.com/nodejs/http-parser.git
Cloning into 'http-parser'...
remote: Counting objects: 1496, done.
remote: Total 1496 (delta 0), reused 0 (delta 0), pack-reused 1496
Receiving objects: 100% (1496/1496), 671.92 KiB | 3.77 MiB/s, done.
Resolving deltas: 100% (921/921), done.
[builder@archbuilder http-parser-git]$ cd http-parser
[builder@archbuilder http-parser]$ make library
cc -I. -DHTTP_PARSER_STRICT=0 -Wall -Wextra -Werror -O3 -fPIC -c http_parser.c -o libhttp_parser.o
cc -shared -Wl,-soname=libhttp_parser.so.2.7 -o libhttp_parser.so.2.7.1 libhttp_parser.o