Skip to content

Instantly share code, notes, and snippets.

Avatar

Dmitry dimzon

  • Wintegra
  • Russian Federation
View GitHub Profile
@dimzon
dimzon / Disable_IPv6.sh
Created Dec 12, 2018 — forked from chenshaoju/Disable_IPv6.sh
Disable IPv6 for Android in init.d
View Disable_IPv6.sh
#!/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
View circleci-tunnel.sh
#!/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 Mar 8, 2018 — forked from sallar/console-example.php
PHP Colored CLI Output Script.
View console-example.php
<?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 Nov 21, 2017 — forked from bcse/scrdec18-VC8.exe
Windows Script Decoder 1.8 (Decoding JScript.Encoded)
View gitcheats.txt
# 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 Sep 22, 2017
Stripped and minified sigle-file drop-in 100% managed LZMA-Alone stream decoder
View unlzma.min.cs
/***********************************************************************************************
* 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 Aug 21, 2017
zstd streaming api wrapper
View zstd.cs
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 Jul 20, 2017
pivot.sql
View 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)
View HTTPServer.cs
// 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
{
@dimzon
dimzon / RowClassTypeBuilder.cs
Created Jun 18, 2017
Dapper dynamic object generation
View RowClassTypeBuilder.cs
namespace ePrinting
{
using System;
using System.Data;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using PropertyAttributes = System.Reflection.PropertyAttributes;
// based on https://stackoverflow.com/questions/3862226/how-to-dynamically-create-a-class-in-c
You can’t perform that action at this time.