Skip to content

Instantly share code, notes, and snippets.

View d3zorg's full-sized avatar

Denis Safronenkov d3zorg

View GitHub Profile
@d3zorg
d3zorg / lekker
Created May 27, 2015 07:48
oh my js
/**
* Copyright (c) 2007-2012 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
* Dual licensed under MIT and GPL.
* @author Ariel Flesler
* @version 1.4.3.1
*/
;(function($){var h=$.scrollTo=function(a,b,c){$(window).scrollTo(a,b,c)};h.defaults={axis:'xy',duration:parseFloat($.fn.jquery)>=1.3?0:1,limit:true};h.window=function(a){return $(window)._scrollable()};$.fn._scrollable=function(){return this.map(function(){var a=this,isWin=!a.nodeName||$.inArray(a.nodeName.toLowerCase(),['iframe','#document','html','body'])!=-1;if(!isWin)return a;var b=(a.contentWindow||a).document||a.ownerDocument||a;return/webkit/i.test(navigator.userAgent)||b.compatMode=='BackCompat'?b.body:b.documentElement})};$.fn.scrollTo=function(e,f,g){if(typeof f=='object'){g=f;f=0}if(typeof g=='function')g={onAfter:g};if(e=='max')e=9e9;g=$.extend({},h.defaults,g);f=f||g.duration;g.queue=g.queue&&g.axis.length>1;if(g.queue)f/=2;g.offset=both(g.offset);g.over=both(g.over);return this._scrollable().each(function(){if
upstream discourse {
#fail_timeout is optional; I throw it in to see errors quickly
server 127.0.0.1:4578 fail_timeout=5;
}
# configure the virtual host
server {
# replace with your domain name
server_name discourse.example.com;
@d3zorg
d3zorg / gist:080bc3139e05e8ab7599
Last active May 23, 2016 01:19
iitc waypoints
// ==UserScript==
// @id iitc-plugin-waypoints
// @name IITC plugin: Waypoints
// @category Layer
// @version 0.0.1
// @author Nobody
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion
// @description Creates paths of waypoints to plan ingress actions in more detail
// @include https://www.ingress.com/intel*
// @include http://www.ingress.com/intel*
@d3zorg
d3zorg / env.rb
Created August 28, 2014 05:46
env.rb
# encoding: utf-8
HTTP_TIMEOUT = 30
def change_separator directories
dir_path = directories.join(File::SEPARATOR)
dir_path.gsub! File::SEPARATOR, File::ALT_SEPARATOR || File::SEPARATOR
end
def includeScripts
fix for hotkeys not functional in non-latin keyboard layout in 13.10 / 14.04
tested on ubuntu 14.04, jvm7 and rubymine 6.3
sudo add-apt-repository ppa:attente/java-non-latin-shortcuts
sudo apt-get update
sudo apt-get dist-upgrade
restart unity-settings-daemon
now ctrl+c, ctrl-v etc should work in most java applications like IDEA, RubyMine IDE even on russian keyboard layout
@d3zorg
d3zorg / dev.pp
Last active August 29, 2015 14:01 — forked from bavadim/dev.pp
# install soft
$soft = ['wget', 'curl', 'zsh', 'cowsay', 'fortune', 'strace',
'sudo', 'mc', 'make', 'gcc', 'tree', 'ntpdate', 'dh-make',
'debhelper', 'devscripts', 'fakeroot', 'openjdk-7-jdk', 'git',
'storm', 'vim', 'md5deep', 'dpkg', 'debconf', 'lintian']
apt::source { 'edisoft':
location => 'http://10.20.20.75:8080/static/edisoft',
release => 'wheezy',
repos => 'main',
key => 'D5EFD011',
@d3zorg
d3zorg / screen.ps1
Created May 31, 2013 07:55
This script takes screenshot on all displays and saves it to shared folder. Can be installed to windows services and run with this vbs with no window ("hidden"): set shell = wscript.createobject("wscript.shell") shell.run "powershell -file C:\Windows\screen.ps1",0,false Run once before install to enable execution of powershell script powershell …
[cmdletbinding()]
param(
[string]$Width,
[string]$Height,
[string]$datestamp = "{0:HH/mm/ss/dd/MM/yyyy}" -f (get-date),
[string]$FileName = $env:COMPUTERNAME + "_screen_" + "$datestamp"
)
function Take-Screenshot{
[cmdletbinding()]
@d3zorg
d3zorg / sin_loadavg.sh
Created March 4, 2013 16:40
makes your loadavg looks like sinusoid with 1 hour period
MAXJOBS=20
for i in `seq 1 $MAXJOBS` ; do nice -n 19 gzip -c /dev/zero > /dev/null & done
while true
do
LA=`</proc/loadavg` && LA=${LA// */}
H=$(date +%M) && H=${H/0/}
G=`echo "(${MAXJOBS}/2)*(s(2*3.14159*${H}/60) +1 ) <= ${LA}" | bc -l`
test ${G} -lt 1 && for i in `seq 1 $MAXJOBS` ; do kill -SIGCONT %$i ; done || for i in `seq 1 $MAXJOBS` ; do kill -SIGSTOP %$i; done
sleep 1
@d3zorg
d3zorg / mysql_profiler.php
Last active December 12, 2015 03:39
simple mysql profiler with built-in mysql tool
<?php
mysql_query("set profiling_history_size=100");
mysql_query("set profiling=1");
#
# your queries here
#
$rs = mysql_query("show profiles");
while($rd = mysql_fetch_object($rs))
@d3zorg
d3zorg / remove_ext.htaccess
Created February 4, 2013 19:32
Remove the .php extension with mod_rewrite
# put into .htaccess or virtual host
RewriteEngine On
RewriteCond %{REQUEST_URI} !\.php$
RewriteRule ^(.+)$ $1.php