Skip to content

Instantly share code, notes, and snippets.

View igroykt's full-sized avatar

igroykt igroykt

View GitHub Profile
@d-bo
d-bo / nginx
Created July 28, 2014 03:14
nginx rc.d init script freebsd
#!/bin/sh
# if compiled from sources
# place this file inside /usr/local/etc/rc.d
# point _pidfrefix where nginx holds pid file
. /etc/rc.subr
name="nginx"
rcvar=nginx_enable
sudo dd if=/dev/zero of=/root/myswapfile bs=1M count=65536
sudo chmod 600 /root/myswapfile
sudo mkswap /root/myswapfile
sudo swapon /root/myswapfile
@freman
freman / evalmyoutput.sh
Created September 6, 2017 23:36
Re-create docker iptables rules
#!/bin/bash
echo "Recreating docker iptables rules and chains"
echo "iptables -N DOCKER"
echo "iptables -N DOCKER-ISOLATION"
echo "iptables -t nat -N DOCKER"
echo "iptables -A DOCKER-ISOLATION -j RETURN"
echo "iptables -A FORWARD -j DOCKER-ISOLATION"
echo "iptables -t nat -A PREROUTING -m addrtype -dst-type LOCAL -j DOCKER"
@eoli3n
eoli3n / encryption.php
Last active May 28, 2024 02:47
Encrypt - Decrypt AES from/to Python PyCryptodome from/to PHP openssl
<?php
// use to generate key : 'openssl rand -hex 32'
function my_encrypt($data, $passphrase) {
$secret_key = hex2bin($passphrase);
$iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length('aes-256-cbc'));
$encrypted_64 = openssl_encrypt($data, 'aes-256-cbc', $secret_key, 0, $iv);
$iv_64 = base64_encode($iv);
$json = new stdClass();
$json->iv = $iv_64;
@patrickbussmann
patrickbussmann / token.php
Created October 17, 2019 23:27
Sign in with Apple - PHP
<?php
# composer require web-token/jwt-framework
require_once 'vendor/autoload.php';
use Jose\Component\Core\AlgorithmManager;
use Jose\Component\KeyManagement\JWKFactory;
use Jose\Component\Signature\Algorithm\ES256;
use Jose\Component\Signature\JWSBuilder;
use Jose\Component\Signature\Serializer\CompactSerializer;