This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Curl a URL and display the different times of the request | |
curl -H 'Cache-Control: no-cache, no-store' -w @- -o /dev/null -s "$@" <<'EOF' | |
time_namelookup: %{time_namelookup}\n | |
time_connect: %{time_connect}\n | |
time_appconnect: %{time_appconnect}\n | |
time_pretransfer: %{time_pretransfer}\n | |
time_redirect: %{time_redirect}\n |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wget --save-cookies cookies.txt --keep-session-cookies http://my-site.dev/app_dev.php/my/page | |
# It's possible to add option "--post-data 'user=foo&password=bar' " if you need to | |
# log in for exemple | |
# Then retrieve the session ID in cookie.txt | |
vendor/h4cc/wkhtmltopdf-amd64/bin/wkhtmltopdf-amd64 \ | |
--cookie 'sessionid' 'gfou6ks1lsguuvtk9il2v169n7' \ | |
--cookie 'PHPSESSID' 'gfou6ks1lsguuvtk9il2v169n7' \ | |
--debug-javascript \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function shouldTextBeBlack (backgroundcolor) { | |
return computeLuminence(backgroundcolor) > 0.179; | |
} | |
function computeLuminence(backgroundcolor) { | |
var colors = hexToRgb(backgroundcolor); | |
var components = ['r', 'g', 'b']; | |
for (var i in components) { | |
var c = components[i]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DROP PROCEDURE IF EXISTS addcol; | |
delimiter '//' | |
CREATE PROCEDURE addcol() BEGIN | |
IF NOT EXISTS( | |
( | |
SELECT * FROM information_schema.COLUMNS | |
WHERE TABLE_SCHEMA=DATABASE() | |
AND TABLE_NAME='my_table' | |
AND COLUMN_NAME='value4' | |
) |