Skip to content

Instantly share code, notes, and snippets.

@Dezinger
Dezinger / minipc.txt
Created January 15, 2020 03:49
MiniPC
https://portal.eaeunion.org/sites/odata/_layouts/15/Portal.EEC.Registry.UI/DisplayForm.aspx?ItemId=61156&ListId=d84d16d7-2cc9-4cff-a13b-530f96889dbc
@Dezinger
Dezinger / chef-noatime-and-swap.rb
Created November 25, 2019 09:35 — forked from priestjim/chef-noatime-and-swap.rb
A quick (hacky) Chef recipe for adding noatime and a swap file in case a swap file does not exist
# Enable noatime on local ext3/4 & xfs filesystems
fstab = File.open('/etc/fstab',"r")
newlines = Array.new
needremount = Array.new
ihaveswap = false
fstab.each do |line|
# Tokenize each fstab line with a space separator
tokens = line.split
if tokens[2] == "swap"
@Dezinger
Dezinger / composer_gzip_test.php
Last active December 12, 2016 08:31 — forked from radutopala/composer_gzip_test.php
Composer GZIP decoding test
<?php
$retries = 0;
function fetch() {
global $retries;
echo "Retry " . $retries . " | ";
$opts = array(
-- Запросы по сбору статистики PostgreSql 9.3.x
-- Процессы которые висят более 20 секунд
select * from pg_stat_activity where state != 'idle' and current_timestamp - query_start > '20 sec';
-- К-во update-тов за время с последнего сброса статистики
SELECT relname, n_tup_ins + n_tup_upd + n_tup_del from pg_stat_user_tables order by 2 desc limit 5;
-- Сброс статистики
SELECT pg_stat_reset();
@Dezinger
Dezinger / mcached.shell
Last active August 29, 2015 13:57
Memcached Console
telnet localhost 11211
Command Description Example
get Reads a value get mykey
set Set a key unconditionally set mykey 0 60 5
add Add a new key add newkey 0 60 5
replace Overwrite existing key replace key 0 60 5
append Append data to existing key append key 0 60 15
prepend Prepend data to existing key prepend key 0 60 15
incr Increments numerical key value by given number incr mykey 2
mkdir ~/git/website.git && ~/git/cd website.git
git init --bare
mkdir ~/webapps/website
git config core.bare false
git config core.worktree /home/rafi/webapps/website ; NO TRAILING SLASH!!! Will screw up things real bad.
git config receive.denycurrentbranch ignore
; create a hook
cat > hooks/post-receive
#!/bin/sh
@Dezinger
Dezinger / random-func-postgresql.sql
Created December 10, 2013 16:59
Random Range
by Scott Bailey 'Artacus' 
http://wiki.postgresql.org/wiki/Random_Range
CREATE OR REPLACE FUNCTION random(numeric, numeric)
RETURNS numeric AS
$$
SELECT ($1 + ($2 - $1) * random())::numeric;
$$ LANGUAGE 'sql' VOLATILE;
SELECT random(1,10)::int, random(1,10);
@Dezinger
Dezinger / create-table-adn-fill-1m-recs.sql
Created November 23, 2013 13:47
Создаем и заполняем таблицу миллионом записей
CREATE TABLE foo (c1 integer, c2 text);
INSERT INTO foo
  SELECT i, md5(random()::text)
  FROM generate_series(1, 1000000) AS i;
@Dezinger
Dezinger / pkg-expander.shell
Created November 7, 2013 20:42
Expand pkg
pkgutil --expand MAMP_2.1.1.pkg /tmp/test/mamp211/
@Dezinger
Dezinger / lib-ver.shell
Created November 7, 2013 20:40
Узнать версию библиотеки в mac os x
otool -L /usr/lib/libssl.0.9.7.dylib