This file contains 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
<?php | |
/** | |
* imageColor | |
* | |
* Shows three methods to find the 'average' image color. | |
* | |
* Each function expects a gd image object. | |
* | |
* imageColor::averageResize($image) resizing to 1px, and checking the color. | |
* imageColor::averageBorder($image) find the average color of all border pixels. |
This file contains 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 | |
# IPv6 Tunnel setup of an tunnelbroker.net tunnel on Linux using the configuration file `/etc/network/interfaces` | |
# (needs the `ip` tool from the iproute suite, Ubuntu package: <http://packages.ubuntu.com/iproute>) | |
# | |
# Run like this: | |
# ./tunnelbroker-net.linux.etc-network-interfaces.sh | |
# | |
# 2011 by Philipp Klaus | |
# Published on <http://blog.philippklaus.de/2011/05/ipv6-6in4-tunnel-via-hurricane-electric-tunnelbroker-net-tunnel-setup-on-ubuntu-11-04/> |
This file contains 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
easterEgg.BadWorder.list={ | |
"4r5e":1, | |
"5h1t":1, | |
"5hit":1, | |
a55:1, | |
anal:1, | |
anus:1, | |
ar5e:1, | |
arrse:1, | |
arse:1, |
This file contains 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
For nginx, | |
location ~* \.(eot|ttf|woff)$ { | |
add_header Access-Control-Allow-Origin *; | |
} | |
Or better way inside virtual host location use, | |
Inside location use | |
if ($request_filename ~* ^.?/([^/]?)$) |
This file contains 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
location /resize { | |
alias /tmp/nginx/resize; | |
set $width 150; | |
set $height 100; | |
set $dimens ""; | |
if ($uri ~* "^/resize_(\d+)x(\d+)/(.*)" ) { | |
set $width $1; | |
set $height $2; | |
set $image_path $3; |
This file contains 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
sudo apt-get install unzip; | |
wget -O /tmp/chromedriver.zip http://chromedriver.googlecode.com/files/chromedriver_linux64_19.0.1068.0.zip && sudo unzip /tmp/chromedriver.zip chromedriver -d /usr/local/bin/; |
This file contains 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 | |
#Force file syncronization and lock writes | |
mongo admin --eval "printjson(db.fsyncLock())" | |
MONGODUMP_PATH="/usr/bin/mongodump" | |
MONGO_HOST="prod.example.com" | |
MONGO_PORT="27017" | |
MONGO_DATABASE="dbname" | |
This file contains 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
for i in `curl https://www.cloudflare.com/ips-v4`; do csf -a $i; done |
This file contains 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
import cv2.cv as cv | |
import tesseract | |
gray = cv.LoadImage('captcha.jpeg', cv.CV_LOAD_IMAGE_GRAYSCALE) | |
cv.Threshold(gray, gray, 231, 255, cv.CV_THRESH_BINARY) | |
api = tesseract.TessBaseAPI() | |
api.Init(".","eng",tesseract.OEM_DEFAULT) | |
api.SetVariable("tessedit_char_whitelist", "0123456789abcdefghijklmnopqrstuvwxyz") | |
api.SetPageSegMode(tesseract.PSM_SINGLE_WORD) | |
tesseract.SetCvImage(gray,api) | |
print api.GetUTF8Text() |
This file contains 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
#!/usr/bin/ruby | |
# Create display override file to force Mac OS X to use RGB mode for Display | |
# see http://embdev.net/topic/284710 | |
require 'base64' | |
data=`ioreg -l -d0 -w 0 -r -c AppleDisplay` | |
edids=data.scan(/IODisplayEDID.*?<([a-z0-9]+)>/i).flatten | |
vendorids=data.scan(/DisplayVendorID.*?([0-9]+)/i).flatten |
OlderNewer