Skip to content

Instantly share code, notes, and snippets.

View random_values.js
function randomIntFromInterval(min, max) {
return Math.floor(Math.random() * (max - min + 1) + min);
}
function generateData() {
var data_list = [];
var random = Math.floor(Math.random() * 10);
@raf-sh
raf-sh / deobfuscation.php
Created December 13, 2017 14:14 — forked from MKorostoff/deobfuscation.php
My attempt to de-obfuscate a PHP exploit file discovered on a hacked server.
View deobfuscation.php
<?php
/**
* First, we're going to establish an alphabet. We're never going to write code like:
*
* $foo = 'abc'
*
* Because it would be too easy to read. Instead, were' going to write code like:
*
* $alphabet = 'abcdefghijklmnopqrstuvwxyz';
View api_call.html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Api tester</title>
</head>
<div id="login">
<form id="formLogin">
Login:<br>
@raf-sh
raf-sh / gist:462af8b22ea9372460be2dc9282b4839
Created December 9, 2016 13:06
recursively remove git traces
View gist:462af8b22ea9372460be2dc9282b4839
( find . -type d -name ".git" && find . -name ".gitignore" && find . -name ".gitmodules" ) | xargs rm -rf
@raf-sh
raf-sh / gist:114c93a1e5e480cec1cc47e40ffbecaa
Created October 6, 2016 10:42
xdebug for console yii1 apps
View gist:114c93a1e5e480cec1cc47e40ffbecaa
zend_extension=/usr/lib/php5/20100525/xdebug.so
xdebug.remote_enable=1
xdebug.remote_port=9000
xdebug.remote_host=192.168.0.104
xdebug.remote_mode=req
xdebug.remote_connect_back=1
xdebug.remote_autostart=0
xdebug.idekey=PHPSTORM
xdebug.serverName=Example
@raf-sh
raf-sh / hg
Created September 27, 2016 09:38
View hg
hg log -r "parents(min(branch(FOO-1636-checkbox-bug)))
View custom PhpStorm VM options
# custom PhpStorm VM options
-Xms1024m
-Xmx2048m
-XX:ReservedCodeCacheSize=1024m
-XX:+UseConcMarkSweepGC
-XX:SoftRefLRUPolicyMSPerMB=512
-ea
-Dsun.io.useCanonCaches=true
-Djava.net.preferIPv4Stack=true
@raf-sh
raf-sh / gist:0cafb9f40d3b967fce79
Created March 31, 2015 12:55
redirect to no-www and from index.(php|html|htm) to /
View gist:0cafb9f40d3b967fce79
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1%{REQUEST_URI} [R=301,QSA,NC,L]
RewriteCond %{THE_REQUEST} ^.*/index\.(php|html?)
RewriteRule ^(.*)index.(php|html?)$ /$1 [R=301,NC,L]
@raf-sh
raf-sh / gist:5567680
Created May 13, 2013 11:28
tables\classified.php
View gist:5567680
<?php
// защита от прямого доступа
defined('_JEXEC') or die('Restricted access');
class Tableclassified extends JTable
{
/**
* Первичный ключ
*
* @var integer
@raf-sh
raf-sh / gist:5567674
Created May 13, 2013 11:27
\models\classified.php
View gist:5567674
public function save($data)
{
$table = $this->getTable();
$ads['text'] = iconv("cp1251", "UTF-8", $date['shptext']);
$ads['phone'] = $data['shpphone'];
$ads['quantity'] = $data['shpquantity'];
$ads['author'] = iconv("cp1251", "UTF-8", $data['shpname']);
$ads['ad_type'] = $data['shpview'];
$ads['cat'] = $data['category'];