Skip to content

Instantly share code, notes, and snippets.

View stokito's full-sized avatar
Self-hosting become easier 🤗

Sergey Ponomarev stokito

Self-hosting become easier 🤗
View GitHub Profile
@carlosame
carlosame / maven-dependency-version-ranges.md
Created July 14, 2020 13:00
Maven dependency version ranges for libraries

Maven dependency version ranges

Introduction

Java:tm: projects generally depend on other projects, and those dependencies are detailed in the file that describes how to build the project, often the Maven POM.

The build process needs to know which version or versions of the dependencies are required to succeed, and projects often specify a single, fixed version, perhaps the same one that was used when the project's code was edited with the help of an IDE. In the Maven POM, this is done by introducing a line like:

1.7.28
@Martin91
Martin91 / postman-pre-request-script-for-shopee-openapi.js
Last active April 16, 2021 17:06
Postman Pre-request script for Shopee OpenAPI's authentication
var CryptoJS = require("crypto-js");
var Property = require('postman-collection').Property;
var now = new Date();
var timestampNow = parseInt(now.getTime() / 1000);
pm.collectionVariables.set("timestamp", timestampNow);
var host = pm.collectionVariables.get("host");
var path = pm.request.url.getPath();
var requestURL = host + path;
@simonswine
simonswine / install-openjdk8-musl.sh
Created August 11, 2019 10:54
Install alpine openjdk8 onto OpenWRT (armv7)
#!/bin/sh
set -o errexit
set -o nounset
set -o pipefail
set -x
REVISION=8.212.04-r0
URL=http://dl-cdn.alpinelinux.org/alpine/v3.10/community/armv7/
PACKAGES="openjdk8 openjdk8-jre openjdk8-jre-lib openjdk8-jre-base"
@asterite3
asterite3 / nginx.sh
Last active October 12, 2023 20:39
Serve current directory with nginx. As a regular (non-root) user (a replacement for python -m SimpleHTTPServer)
#!/bin/bash
# Usage:
# ./nginx.sh
# ./nginx.sh 8888
# ./nginx.sh 0.0.0.0 8080
set -e
HOST="127.0.0.1"
@Paratron
Paratron / docker-shell.sh
Created February 5, 2019 13:29
Open a shell into a running docker container
docker exec -ti container_id bash
@markscottwright
markscottwright / PKCS7.java
Last active June 16, 2024 15:27
How to create a PKCS7/CMS signature using BouncyCastle
package scratch;
import java.io.FileInputStream;
import java.io.IOException;
import java.security.KeyStore;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.security.PrivateKey;
import java.security.Provider;
import java.security.Security;
@peci1
peci1 / check_raid_status.sh
Last active December 17, 2024 20:06
A script for Turris Omnia that checks the status of a JMicron JMS56x RAID controller and sends a notification if something's wrong.
#!/bin/bash
# Based on the script from https://forum.odroid.com/viewtopic.php?t=29298
# Changes to that script are released under BSD license (c) Martin Pecka, 2019.
# raidmgr_static can be downloaded here: https://wiki.odroid.com/_media/accessory/add-on_boards/xu4_cloudshell2/raidmgr_static_cloudshell2.zip
RAID_MANAGER="/usr/bin/raidmgr_static"
STATUS="$(echo -e "SR C0\nEX\n" | $RAID_MANAGER)"
@riccardomc
riccardomc / dns.go
Created November 29, 2018 10:14
Minimal DNS proxy in golang. Reply NXDOMAIN for AAAA queries.
package main
import (
"log"
"net"
"os"
"strconv"
"github.com/miekg/dns"
)
@mtigas
mtigas / onion-svc-v3-client-auth.sh
Last active March 1, 2025 03:50
experiments with using v3 onions with client auth (as of tor 0.3.5.X)
#!/bin/bash
# needs openssl 1.1+
# needs `basez` https://manpages.debian.org/testing/basez/base32hex.1.en.html
# (but something else that decodes the base64 and re-encodes the raw key bytes
# to base32 is probably fine too)
##### generate a key
openssl genpkey -algorithm x25519 -out /tmp/k1.prv.pem
@KevCui
KevCui / jwtDecoder.sh
Last active September 7, 2020 09:08
A Bash script to decode JWT token
#!/usr/bin/env bash
# HOW TO USE:
# ~$ chmod +x jwtDecoder.sh
# ~$ ./jwtDecoder.sh "<JWT token>"
padding() {
# $1: base64 string
local m p=""
m=$(( ${#1} % 4 ))
[[ "$m" == 2 ]] && p="=="