Skip to content

Instantly share code, notes, and snippets.

View dimzon's full-sized avatar

Dmitry dimzon

  • Wintegra
  • Russian Federation
View GitHub Profile
@dimzon
dimzon / haproxy_ssl_request_passthrough_ver2.txt
Created February 12, 2024 12:50 — forked from hxyconan/haproxy_ssl_request_passthrough_ver2.txt
Haproxy configuration for SSL request passthrough to different backend based on SNI
# Haproxy configuration for SSL request passthrough to different backend based on SNI read from Handshaking stage
# The Loadbalance will not decode the encrpted data but transparently transfer to the backend server in Private subnet.
# With such configuration, you can install multiply services with its own SSL certificate in backend in different EC2 instance, but only explosure to public internet with one Loadbalance IP. There is no need to install SSL certificate in Loadbalancer level.
# Ref:
# How to support wildcard sni: https://stackoverflow.com/questions/24839318/haproxy-reverse-proxy-sni-wildcard
# https://www.haproxy.com/blog/enhanced-ssl-load-balancing-with-server-name-indication-sni-tls-extension/
# https://stuff-things.net/2016/11/30/haproxy-sni/
@dimzon
dimzon / Disable_IPv6.sh
Created December 12, 2018 08:47 — forked from chenshaoju/Disable_IPv6.sh
Disable IPv6 for Android in init.d
#!/system/bin/sh
#
echo 0 > /proc/sys/net/ipv6/conf/default/accept_ra
echo 1 > /proc/sys/net/ipv6/conf/default/disable_ipv6
echo 0 > /proc/sys/net/ipv6/conf/all/accept_ra
echo 1 > /proc/sys/net/ipv6/conf/all/disable_ipv6
echo 0 > /proc/sys/net/ipv6/conf/wlan0/accept_ra
echo 1 > /proc/sys/net/ipv6/conf/wlan0/disable_ipv6
sleep 3
echo 0 > /proc/sys/net/ipv6/conf/default/accept_ra
@dimzon
dimzon / circleci-tunnel.sh
Created April 30, 2018 02:33 — forked from davidlukac/circleci-tunnel.sh
VPN via Redsocks
#!/usr/bin/env bash
set -xe
SSH_USER_PWD="${SSH_USER_PWD}"
SSH_USER="${SSH_USER}"
VPN_GATEWAY="${VPN_GATEWAY}"
sshpass -p "${SSH_USER_PWD}" ssh -o StrictHostKeyChecking=no -v "${SSH_USER}@${VPN_GATEWAY}" -22 -D 9999 -nf "sleep 90000" &
echo 'base{log_debug = on; log_info = on; log = "file:/tmp/reddi.log";daemon = on; redirector = iptables;}redsocks { local_ip = 127.0.0.1; local_port = 12345; ip = 127.0.0.1;port = 9999; type = socks5; }' > ~/redsocks.conf
@dimzon
dimzon / console-example.php
Created March 8, 2018 11:42 — forked from sallar/console-example.php
PHP Colored CLI Output Script.
<?php
// Output screenshot:
// http://cl.ly/NsqF
// -------------------------------------------------------
include_once 'console.php';
// ::log method usage
// -------------------------------------------------------
Console::log('Im Red!', 'red');
@dimzon
dimzon / scrdec18-VC8.exe
Created November 21, 2017 09:05 — forked from bcse/scrdec18-VC8.exe
Windows Script Decoder 1.8 (Decoding JScript.Encoded)
@dimzon
dimzon / gitcheats.txt
Created October 19, 2017 21:26 — forked from chrismccoy/gitcheats.txt
git cheats
# shortform git commands
alias g='git'
# get a list of all commit messages for a repo
git log --pretty=format:'%s'
# push changes to an empty git repository for the first time
git push --set-upstream origin master
# Remove + and - from start of diff lines
@dimzon
dimzon / unlzma.min.cs
Created September 22, 2017 14:53
Stripped and minified sigle-file drop-in 100% managed LZMA-Alone stream decoder
/***********************************************************************************************
* Stripped and minified sigle-file drop-in 100% managed LZMA-Alone stream decoder.
* Compiled IL takes approx 10Kb only.
*
* Original code taken from LZMA SDK http://www.7-zip.org/sdk.html
*
* Decoder is placed in the public domain.
* Anyone is free to copy, modify, publish, use, compile, sell, or distribute the
* original code, either in source code form or as a compiled binary,
* for any purpose, commercial or non-commercial, and by any means.
@dimzon
dimzon / zstd.cs
Created August 21, 2017 10:18
zstd streaming api wrapper
using System;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Runtime.InteropServices;
namespace ZstdCompression
{
public static class Zstd
{
@dimzon
dimzon / pivot.sql
Last active July 20, 2017 23:27
pivot.sql
create function dbo.fnSqlPivot(@sqlCheck nvarchar(4000), @sqlVal nvarchar(4000), @type nvarchar(128)) returns nvarchar(4000) as begin
declare @s nvarchar(4000)
declare @a nvarchar(4000)
declare @b nvarchar(4000)
declare @c nvarchar(4000)
select
@c='))end',
@b='case when '+@sqlCheck+' then '+@sqlVal+' end',
@a='case when max(case when('+@sqlCheck+')and(('+@sqlVal+') is not null)then 1 else 0 end)=1 then max(isnull(',
@s = case lower(@type)
@dimzon
dimzon / HTTPServer.cs
Created July 1, 2017 20:17 — forked from zezba9000/HTTPServer.cs
HTTP C# server
// Modified from: https://gist.github.com/aksakalli/9191056
using System;
using System.Collections.Generic;
using System.Net;
using System.IO;
using System.Threading;
namespace MyNamespace
{