Skip to content

Instantly share code, notes, and snippets.

View sashka's full-sized avatar
🧭
Exploring Zig

sashka

🧭
Exploring Zig
View GitHub Profile
Server nginx/0.8.4.2424.6e04473 banss3.banners.mail.ru
Last config reload: 1283168088 (30/Aug/2010 15:34:48 +0400)
Active connections: 2
server accepts handled requests
2543779 2543779 2497188
Reading: 1 Writing: 1 Waiting: 0
Requests for last 74 sec: 15
@sashka
sashka / gist:4104444
Created November 18, 2012 10:04
In-browser AB Tests at Ostrovok.
<script>
OTA = window.OTA || {};
OTA.experiments = {
'browser_session_key': 'ab_sess_id',
'forced_experiment_name': 'experiment_name',
'forced_experiment_group': 'experiment_group',
'forced_test': 'test',
'forced_control': 'control',
Абрикосовый #fbceb1 251, 206, 177 0, 18, 29, 2
Абрикосовый Крайола #fdd9b5 253, 217, 181 0, 14, 28, 1
Агатовый серый #b5b8b1 181, 184, 177 2, 0, 4, 28
Аквамариновый #7fffd4 127, 255, 212 50, 0, 17, 0
Аквамариновый Крайола #78dbe2 120, 219, 226 47, 3, 0, 11
Ализариновый красный #e32636 227, 38, 54 0, 83, 76, 11
Алый #ff2400 255, 36, 0 0, 86, 100, 0
Амарантово-глубоко-пурпурный #9f2b68 159, 43, 104 0, 73, 35, 38
Амарантово-пурпурный #ab274f 171, 39, 79 0, 77, 54, 33
Амарантово-розовый #f19cbb 241, 156, 187 0, 35, 22, 5
// Copyright 2010 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
#!/usr/bin/env python
import argparse
import logging
import os
import re
import subprocess
from itertools import islice
@sashka
sashka / curl-check.sh
Created April 22, 2013 12:44
Monitor HTTP response with Curl
response=$(curl --write-out %{http_code} --silent --output /dev/null http://httpbin.org/status/200)
if [ $response -gt 302 ]; then
echo ${response}
fi
#!/bin/bash
f=$(pwd)
sips --resampleWidth 512 "${f}/${1}" --out "${f}/iTunesArtwork"
sips --resampleWidth 1024 "${f}/${1}" --out "${f}/iTunesArtwork@2x"
sips --resampleWidth 57 "${f}/${1}" --out "${f}/Icon.png"
sips --resampleWidth 114 "${f}/${1}" --out "${f}/Icon@2x.png"
sips --resampleWidth 29 "${f}/${1}" --out "${f}/Icon-Small.png"
sips --resampleWidth 58 "${f}/${1}" --out "${f}/Icon-Small@2x.png"
sips --resampleWidth 50 "${f}/${1}" --out "${f}/Icon-Small-50.png"

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert $1 -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 $2

Results

Business Models

Advertising

Models Examples
Display ads Yahoo!
Search ads Google
#!/bin/bash
response=$(mysql -P 9306 -h 127.0.0.1 --connect-timeout=3 -e 'select count(*) from products\G' | grep count | cut -d' ' -f2)
if [ "${response}" == "" ]; then
sudo /etc/init.d/sphinxsearch restart
fi