Skip to content

Instantly share code, notes, and snippets.

View brsnik's full-sized avatar

Boris Nikk brsnik

  • Skopje, MK
  • 19:42 (UTC +02:00)
View GitHub Profile
@pedrouid
pedrouid / webcrypto-examples.md
Created December 15, 2018 01:07
Web Cryptography API Examples
@ryantbrown
ryantbrown / s3upload.sh
Created February 1, 2018 07:25
Bash script to Upload folder to S3
# Set AWS credentials and S3 paramters
AWS_KEY=""
AWS_SECRET=""
S3_BUCKET=""
S3_BUCKET_PATH="/"
S3_ACL="x-amz-acl:private"
function s3Upload
{
path=$1
@yingshaoxo
yingshaoxo / asyncio_server.py
Last active July 8, 2020 08:05
asyncio TCP server
import asyncio
class EchoServerClientProtocol(asyncio.Protocol):
def connection_made(self, transport):
self.transport = transport
self.peername = transport.get_extra_info('peername')
print('Connection from {}'.format(self.peername))
def data_received(self, data):
@esurdam
esurdam / ecdsa_openssl.md
Last active December 21, 2023 09:12
Generate ECDSA certs

ECDSA Certs with LetsEncrypt

More on ECDSA

Info on bit length and complexity

From it you may gather that using 256 bit ECDSA key should be enough for next 10-20 years.

To view your available curves

@meskarune
meskarune / nftables.conf
Created May 25, 2016 02:16
nftables config for ipv4
#!/usr/bin/nft -f
# ipv4/ipv6 Simple & Safe Firewall
# you can find examples in /usr/share/nftables/
flush ruleset
table firewall {
chain incoming {
type filter hook input priority 0;
@dayreiner
dayreiner / sysctl.conf
Last active July 14, 2023 06:25
A decent base to start tuning off of for centos 7 apache and mariadb systems
# MariaDB Tuning
vm.swappiness = 1
fs.file-max = 2097152
vm.dirty_ratio = 60
vm.dirty_background_ratio = 2
# Sets the time before the kernel considers migrating a proccess to another core
kernel.sched_migration_cost_ns = 5000000
# Group tasks by TTY
@drmalex07
drmalex07 / README-oneshot-systemd-service.md
Last active July 7, 2024 19:47
An example with an oneshot service on systemd. #systemd #systemd.service #oneshot

README

Services declared as oneshot are expected to take some action and exit immediatelly (thus, they are not really services, no running processes remain). A common pattern for these type of service is to be defined by a setup and a teardown action.

Let's create a example foo service that when started creates a file, and when stopped it deletes it.

Define setup/teardown actions

Create executable file /opt/foo/setup-foo.sh:

@umrysh
umrysh / mailgun-webhook.php
Created January 29, 2015 23:11
Very simple PHP webhook for Mailgun that emails you on errors.
<?php
$key = "<API Key>";
$from = "[email protected]";
$to = "[email protected]";
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
if(isset($_POST['timestamp']) && isset($_POST['token']) && isset($_POST['signature']) && hash_hmac('sha256', $_POST['timestamp'] . $_POST['token'], $key) === $_POST['signature'])
{
if($_POST['event'] == 'complained') {
@fsmv
fsmv / miniupnpcTest.c
Created September 12, 2014 19:47
Miniupnpc Port Forwarding Example
#include <stdio.h>
#include <arpa/inet.h> //INET6_ADDRSTRLEN
#include <miniupnpc/miniupnpc.h>
#include <miniupnpc/upnpcommands.h>
int main(int argc, char *argv[]) {
int error = 0;
//get a list of upnp devices (asks on the broadcast address and returns the responses)
struct UPNPDev *upnp_dev = upnpDiscover(1000, //timeout in milliseconds
NULL, //multicast address, default = "239.255.255.250"
@gavinhungry
gavinhungry / nginx-tls.conf
Last active March 7, 2025 19:38
Nginx SSL/TLS configuration for "A+" Qualys SSL Labs rating
#
# Name: nginx-tls.conf
# Auth: Gavin Lloyd <[email protected]>
# Desc: Nginx SSL/TLS configuration for "A+" Qualys SSL Labs rating
#
# Enables HTTP/2, PFS, HSTS and OCSP stapling. Configuration options not related
# to SSL/TLS are not included here.
#
# Additional tips:
#