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/env ruby | |
SPECIAL_TOKEN = 'SpecialTokenForSearch' | |
WITHOUT_MERGES = "--no-merges" | |
GIT_COMMIT_LINK="https://github.com/some_projects/commit/:commit" | |
cmd = `git show-ref --tags` | |
tags = [] | |
cmd.each do |l| | |
tag_commit, tag_name = l.chomp.split(" ") |
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
require "google_spreadsheet" | |
namespace :deploy do | |
desc "Notify GD" | |
task :gd_notify, :except => { :no_release => true } do | |
rails_env = fetch(:rails_env, "production") | |
local_user = ENV['USER'] || ENV['USERNAME'] | |
local_branch = fetch(:branch, "HEAD") | |
SPECIAL_TOKEN = 'SpecialTokenForSearch' |
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
require 'RMagick' | |
class ImageDiff | |
#max = 20 | |
MATRIX = 15 | |
def generate_array(image_path) | |
result = [] | |
main_img = Magick::Image.read(image_path).first |
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 | |
class ImageDiff { | |
// not bigger 20 | |
private $matrix = 20; | |
public function getImageInfo($image_path){ | |
list($width, $height, $type, $attr) = getimagesize($image_path); | |
$image_type = ''; |
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 | |
# simple shmsetup script | |
page_size=`getconf PAGE_SIZE` | |
phys_pages=`getconf _PHYS_PAGES` | |
shmall=`expr $phys_pages / 2` | |
shmmax=`expr $shmall \* $page_size` | |
echo kernel.shmmax = $shmmax | |
echo kernel.shmall = $shmall |
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
iwlist wlan0 scan | sed -n 's/.* Address: //p;T;s/ //g;q' | | |
sed 's/.*/{version:1.1.0,host:maps.google.com,request_address:true,address_language:'${LANG/.*/}',wifi_towers:[{mac_address:"&",signal_strength:8,age:0}]}/' | | |
curl -sX POST -d @- www.google.com/loc/json | | |
sed -e 'h;s/.*latitude":\([^,]*\).*/\1/;G;s/\n[^\n]*longitude":\([^,]*\).*/,\1\n/;s|^|http://maps.google.com/maps?q=|;x;s/[,{]/\n/g;s/["}]//g;s/:/\t/g;s/\n//;G' |
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
SELECT nspname || '.' || relname AS "relation", | |
pg_size_pretty(pg_relation_size(C.oid)) AS "size" | |
FROM pg_class C | |
LEFT JOIN pg_namespace N ON (N.oid = C.relnamespace) | |
WHERE nspname NOT IN ('pg_catalog', 'information_schema') | |
ORDER BY pg_relation_size(C.oid) DESC | |
LIMIT 20; |
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
SELECT nspname || '.' || relname AS "relation", | |
pg_size_pretty(pg_total_relation_size(C.oid)) AS "total_size" | |
FROM pg_class C | |
LEFT JOIN pg_namespace N ON (N.oid = C.relnamespace) | |
WHERE nspname NOT IN ('pg_catalog', 'information_schema') | |
AND C.relkind <> 'i' | |
AND nspname !~ '^pg_toast' | |
ORDER BY pg_total_relation_size(C.oid) DESC | |
LIMIT 20; |
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
CREATE LANGUAGE plpgsql; | |
CREATE FUNCTION count_estimate(query text) RETURNS integer AS $$ | |
DECLARE | |
rec record; | |
rows integer; | |
BEGIN | |
FOR rec IN EXECUTE 'EXPLAIN ' || query LOOP | |
rows := substring(rec."QUERY PLAN" FROM ' rows=([[:digit:]]+)'); | |
EXIT WHEN rows IS NOT NULL; | |
END LOOP; |
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
CREATE OR REPLACE FUNCTION ret_def(text,text,text) RETURNS text AS $$ | |
SELECT | |
COLUMNS.column_default::text | |
FROM | |
information_schema.COLUMNS | |
WHERE table_name = $2 | |
AND table_schema = $1 | |
AND column_name = $3 | |
$$ LANGUAGE sql IMMUTABLE; |
OlderNewer