Skip to content

Instantly share code, notes, and snippets.

View Ruzzz's full-sized avatar

Ruslan Zaporojets Ruzzz

View GitHub Profile
:: Note: rename openssl.exe -> openssl64.exe
:: Edit: \Configurations\10-main.conf
:: Replace: /subsystem:console -> /subsystem:console,5.02
::
:: INIT XP x64 TOOLCHAIN
::
set SDK71PATH=%ProgramFiles%\Microsoft SDKs\Windows\7.1A
path %SDK71PATH%\Bin\x64;%PATH%
set INCLUDE=%SDK71PATH%\Include;%INCLUDE%
:: Edit: \Configurations\10-main.conf
:: Replace: /subsystem:console -> /subsystem:console,5.01
::
:: INIT XP x32 TOOLCHAIN
::
set SDK71PATH=%ProgramFiles%\Microsoft SDKs\Windows\7.1A
path %SDK71PATH%\Bin;%PATH%
set INCLUDE=%SDK71PATH%\Include;%INCLUDE%
set LIB=%SDK71PATH%\Lib;%LIB%
@Ruzzz
Ruzzz / vc++_from_cmd.cmd
Last active June 19, 2017 14:29
Using different versions of VC++ from the command line
:: Для использования XP TOOLCHAIN с нужным компилятором
:: нужно установить переменные до инициализации компилятора
:: INIT XP x32 TOOLCHAIN
set SDK71PATH=%ProgramFiles%\Microsoft SDKs\Windows\7.1A
path %SDK71PATH%\Bin;%PATH%
set INCLUDE=%SDK71PATH%\Include;%INCLUDE%
set LIB=%SDK71PATH%\Lib;%LIB%
if exist "%VS150COMNTOOLS%" goto :EOF
:: Build Tools
if not exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\BuildTools" goto :VS2017_COMMUNITY
setx /M VS150COMNTOOLS "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\BuildTools\Common7\Tools\\"
goto :EOF
:: Community
:VS2017_COMMUNITY
if not exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Community" goto :VS2017_PROFESSIONAL
@Ruzzz
Ruzzz / VS140COMNTOOLS_in_VS2017_fix.reg
Created May 24, 2017 07:48
Fix VS140COMNTOOLS VS2017 (ERROR: Cannot determine the location of the VS Common Tools folder)
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\VisualStudio\SxS\VS7]
"14.0"="c:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\14.0\\"
#!/bin/bash
# Step 1:
# Enable UPnP in Linksys E900
# Step 2:
# sudo nano /usr/sbin/wanip_linksys_e900_upnp.sh
# sudo chmod +x /usr/sbin/wanip_linksys_e900_upnp.sh
curl -H "SOAPAction: urn:schemas-upnp-org:service:WANIPConnection:1#GetExternalIPAddress" -d "<?xml version="1.0"?><s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><u:GetExternalIPAddress xmlns:u="urn:schemas-upnp-org:service:WANIPConnection:1"></u:GetExternalIPAddress></s:Body></s:Envelope>" http://192.168.1.1:1780/control?WANIPConnection
# /etc/ddclient/ddclient.conf
daemon=1h
syslog=yes
use=web, web=dnspark
ssl=yes
protocol=cloudflare
server=api.cloudflare.com/client/v4
zone=MYDOMEN.TLD
login=CLOUDFLARE_ACCOUNT_MAIL
# See API-KEY https://www.cloudflare.com/a/account/my-account
# If needed install: JSON::Any, Data::Validate::IP, IO::Socket::SSL
sudo apt-get install libjson-any-perl libdata-validate-ip-perl libio-socket-ssl-perl
cd ~
wget https://raw.githubusercontent.com/wimpunk/ddclient/master/ddclient
sudo cp ddclient /usr/sbin/ddclient
sudo chmod +x /usr/sbin/ddclient
sudo mkdir /var/cache/ddclient
sudo mkdir /etc/ddclient
sudo nano /etc/ddclient/ddclient.conf
@Ruzzz
Ruzzz / prepareForDom.php
Last active January 15, 2017 14:12
Функция подготовки html-кода для работы с DOM — решает проблемы с кириллицей
<?php
function prepareForDOM($html, $inCharset) {
if ($inCharset != 'utf8' && $inCharset != 'utf-8')
$html = iconv($inCharset, 'UTF-8//TRANSLIT', $html);
$html = preg_replace('/<(script|style|noscript)\b[^>]*>.*?<\/\1\b[^>]*>/is', '', $html);
$tidy = new tidy;
$config = array( // See http://tidy.sourceforge.net/docs/quickref.html
'drop-font-tags' => true,
'drop-proprietary-attributes' => true,
'hide-comments' => true,
@Ruzzz
Ruzzz / diff_big.cpp
Last active January 2, 2017 14:39
Show differense of big files with same size (use WinAPI)
// The MIT License (MIT)
// Copyright (c) 2016 Ruslan Zaporojets
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//