Skip to content

Instantly share code, notes, and snippets.

@alder
alder / accessibility_bookmarklet.js
Created July 10, 2017 16:55
Accessibility bookmarklet from testersio.slack.com
javascript:(function(){var s=document.getElementById("colourblind-styling");var x=document.getElementById("colourblind-filters");if(!s){s=document.createElement("style");document.body.appendChild(s)}if(!x){x=document.createElement("div");x.setAttribute("style","height: 0; padding: 0; margin: 0; line-height: 0;");x.innerHTML='<svg id="colorblind-filters" style="display: none"> <defs> <filter id="protanopia"> <feColorMatrix type="matrix" values="0.567,0.433,0,0,0 0.558,0.442,0,0,0 0 0.242,0.758,0,0 0,0,0,1,0" in="SourceGraphic" /> </filter> <filter id="protanomaly"> <feColorMatrix type="matrix" values="0.817,0.183,0,0,0 0.333,0.667,0,0,0 0,0.125,0.875,0,0 0,0,0,1,0" in="SourceGraphic" /> </filter> <filter id="deuteranopia"> <feColorMatrix type="matrix" values="0.625,0.375,0,0,0 0.7,0.3,0,0,0 0,0.3,0.7,0,0 0,0,0,1,0" in="SourceGraphic" /> </filter> <filter id="deuteranomaly"> <feColorMatrix type="matrix" values="0.8,0.2,0,0,0 0.258,0.742,0,0,0 0,0.142,0.858,0,0 0,0,0,1,0" in="SourceGraphic" /> </filter> <filter
class A:
def b(self):
pass
if A.b is A.b:
print("Python 3")
else:
print("Python 2")
@alder
alder / gist:0ded5707f626a09c63d9
Created January 26, 2015 16:08
JMeter remote
# для запуска JMeter-сервера
./jmeter-server -Djava.rmi.server.hostname=192.168.0.10
# для запуска JMeter-клиента в той же локальной сети, что и ноды
./jmeter
# для запуска JMeter-клиента в локальной сети, отличной от сети нод
./jmeter -Djava.rmi.server.hostname=192.168.1.10
@alder
alder / gist:5b70fa57501c2a3abea4
Last active August 29, 2015 14:14
PerfMon EXEC examples
#Example1: Monitoring Linux cached memory size, used free utility output:
/bin/sh:-c:free | grep Mem | awk '{print $7}'
#Example2: Monitoring MySQL select query count:
/bin/sh:-c:echo "show global status like 'Com_select'" | mysql -u root | awk '$1 =="Com_select" {print $2}'
#Example3: Monitoring PostgreSQL CPU usage in percents:
/bin/sh:-c:ps aux | grep "postgres" | grep -v "grep" | grep "puser" | awk 'BEGIN {c = 0} {a = $3; c += a} END {print c}'
@alder
alder / gist:1420a45c19cb947e03ce
Created January 12, 2015 16:04
Manually read CSV data in JMeter witn BeanShell
import java.text.*;
import java.io.*;
import java.util.*;
String filename = "oprosnik_" + vars.get("fileNum") + ".csv";
ArrayList strList = new ArrayList();
try {
File file = new File(filename);
@alder
alder / gist:8575334
Created January 23, 2014 09:05
Run Firefox/Chrome in XVFB. Selenium, Java
http://thegreenoak.blogspot.com/2013/12/running-selenium-grid-and-firefox-in-x.html
http://itsallabtamil.blogspot.com/2013/02/setting-up-chrome-firefox-ec2-selenium-java.html
http://www.labelmedia.co.uk/blog/setting-up-selenium-server-on-a-headless-jenkins-ci-build-machine.html
http://ralf.schaeftlein.de/2012/05/26/running-headless-webdriver-based-selenium-junit-tests-inside-jenkins-under-ubuntu-linux/