Skip to content

Instantly share code, notes, and snippets.

Ruslan Zaporojets Ruzzz

Block or report user

Report or block Ruzzz

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Ruzzz
Ruzzz / speed_limit.php
Last active Oct 12, 2015
Php | Test | Speed limit
View speed_limit.php
<?php
$filename = $_GET['file'];
$downloadRate = isset($_GET['speed']) ? intval($_GET['speed']) : 500;
if (file_exists($filename) && is_file($filename))
{
header('Cache-control: private');
header('Content-Type: application/x-shockwave-flash'); // Set MIME
header('Content-Length: '.filesize($filename));
@Ruzzz
Ruzzz / ant_build_opera_ext.xml
Last active Feb 2, 2016
Example | Build Opera extension (ANT)
View ant_build_opera_ext.xml
<?xml version="1.0"?>
<project name="OperaExtensionBuild" default="build-opera-extension" basedir=".">
<!-- Vars -->
<property name="main-url" value="EXT-PAGE-URL"></property>
<property name="release-base-url" value="UPDATE-BASE-URL"></property>
<property name="config-file" value="config.xml"/>
<property name="src-dir" value="src"/>
<property name="release-dir" value="release"/>
<property name="temp-dir" value="temp"/>
@Ruzzz
Ruzzz / oem_logon_background.bat
Created Nov 16, 2012
Windows OEM Logon Background Enable
View oem_logon_background.bat
REM run as admin, picture must be JPEG, picture size must be not more than 256KB
REM SET img_path=%1 or SET img_path="path to jpg" or
SET img_path=%~dp0background.jpg
SET bg_path=%SystemRoot%\system32\oobe\info\backgrounds
MD %bg_path%
COPY %img_path% %bg_path%\BackgroundDefault.jpg
REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\Background" /v OEMBackground /t REG_DWORD /d 1 /f
REM Shadow of controls: 0 - transparent shadow, 1 - shadow, 2 - no shadow
REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI" /v ButtonSet /t REG_DWORD /d 1 /f
View encode_dom_to_url.js
(function () {
// From http://www.webtoolkit.info/javascript-base64.html
var Base64 = {
_keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
encode : function (input) {
var output = "";
var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
@Ruzzz
Ruzzz / fast_x86_math_func.c
Created Nov 16, 2012
Быстрые мат. функции на си (нашел где-то)
View fast_x86_math_func.c
int floor(float a)
{
int b = (int)a;
if (a >= 0 || (a - b) == 0)
return b;
else
return b - 1;
}
int trunc(float r)
@Ruzzz
Ruzzz / simple_parser.cpp
Created Nov 16, 2012
C++ Simple Parser
View simple_parser.cpp
template <class T, class CharType>class Parser
{
Parser(T &t) :: m_curr(t.begin()) , m_end(t.end()) {}
bool next_char(CharType *c) {
bool not_eof = m_curr != m_end;
if (not_eof) {
*c = *m_curr;
m_curr++;
}
@Ruzzz
Ruzzz / AStyle_for_Notepade++_and_VS.txt
Last active Oct 12, 2015
My AStyle Settings (Notepade++,Visual Studio)
View AStyle_for_Notepade++_and_VS.txt
See http://sourceforge.net/projects/astyle/
Notepade++
Script for NppExec:
NPP_SAVE
cd $(CURRENT_DIRECTORY)
с:\apps\dev\AStyle\AStyle.exe -A1 -s4 -S -w -Y -m0 -M120 -p -H -U -k3 -W3 -xj -c -xy -Z -z1 "$(FILE_NAME)"
Visual Studio
@Ruzzz
Ruzzz / GoogleClosureCompiler_for_Notepade++.txt
Last active Oct 12, 2015
Google Closure Compiler for Notepade++
View GoogleClosureCompiler_for_Notepade++.txt
Script for NppExec:
NPP_SAVE
cd $(CURRENT_DIRECTORY)
java -jar f:\apps\dev\GoogleClosureCompiler\compiler.jar --js "$(FILE_NAME)" --js_output_file "$(NAME_PART)_min$(EXT_PART)"
@Ruzzz
Ruzzz / min_win32_gui_app.cpp
Created Nov 16, 2012
Minimal Windows GUI Program
View min_win32_gui_app.cpp
#include <windows.h>
static TCHAR szWindowClass[] = TEXT("MinAppWindowClass");
static TCHAR szTitle[] = TEXT("Min App");
HINSTANCE hInst;
HWND hWnd;
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
@Ruzzz
Ruzzz / prepareForDom.php
Last active Jan 15, 2017
Функция подготовки html-кода для работы с DOM — решает проблемы с кириллицей
View prepareForDom.php
<?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,
You can’t perform that action at this time.