Skip to content

Instantly share code, notes, and snippets.

@meniam
meniam / README.md
Created January 26, 2022 23:24
Installing Sentry on Debian

Installing Sentry on Debian

Install aptitude packages

sudo apt-get update
sudo apt-get install python python-setuptools python-pip python-dev libxslt1-dev libxml2-dev libmysqlclient-dev

Install and activate virtualenv

sudo pip install -U virtualenv
virtualenv /clients/sentry/

source /clients/sentry/bin/activate

@meniam
meniam / mime-to-nginx.sh
Last active May 15, 2021 13:24
Convert /etc/mime.types to nginx MIME types Format
<?php
$shortopts = "m:";
$shortopts .= "o::";
$shortopts .= "i::";
$shortopts .= "f::";
$options = getopt($shortopts);
if (!$options) {
echo "Usage:\n\n";
@meniam
meniam / 00_OSX_Docker_Machine_Setup.md
Created August 5, 2019 15:56 — forked from bitjockey42/00_OSX_Docker_Machine_Setup.md
Use native virtualization on OS X docker with xhyve

What this?

So one of the painful points of using docker on OS X is that you need to run a virtualbox VM, which often suffers from performance issues. With xhyve, a OS X virtualization system, and docker-machine-xhyve you can now have docker use the native OS X hypervisor to run containers.

No more dealing with virtualbox shenanigans!

In this script, I've also set up a way to autoconfigure terminal sessions to load docker's environment vars (dependent on docker-machine) so you do not have to run eval $(docker-machine env whatever) every time you open a new terminal window.

Requirements

Keybase proof

I hereby claim:

  • I am meniam on github.
  • I am emyazin (https://keybase.io/emyazin) on keybase.
  • I have a public key whose fingerprint is 7342 413D D3B3 AF2B 4DBB F709 75B5 2FE4 F7D9 8513

To claim this, I am signing this object:

CREATE OR REPLACE VIEW public.unused_indexes AS
SELECT
(pg_stat_all_indexes.schemaname :: TEXT || '.' :: TEXT) || pg_stat_all_indexes.relname :: TEXT,
pg_stat_all_indexes.indexrelname,
pg_stat_all_indexes.idx_scan,
pg_size_pretty(
pg_relation_size(((pg_stat_all_indexes.schemaname :: TEXT || '.' :: TEXT) || pg_stat_all_indexes.indexrelname :: TEXT) :: REGCLASS)) AS pg_size_pretty
FROM pg_stat_all_indexes
WHERE (pg_stat_all_indexes.schemaname <> ALL (ARRAY ['pg_toast' :: NAME, 'pg_catalog' :: NAME])) AND pg_stat_all_indexes.idx_scan = 0 AND
pg_relation_size(((pg_stat_all_indexes.schemaname :: TEXT || '.' :: TEXT) || pg_stat_all_indexes.indexrelname :: TEXT) :: REGCLASS) >
@meniam
meniam / 0_reuse_code.js
Created March 8, 2016 10:36
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@meniam
meniam / getAbsoluteUrl.js
Last active January 28, 2016 00:15
getAbsoluteUrl - Получить абсолютный URL
var getAbsoluteUrl = (function() {
var a;
return function(url) {
if(!a) a = document.createElement('a');
a.href = url;
return a.href;
};
})();
@meniam
meniam / gist:7886682
Created December 10, 2013 06:49 — forked from fomigo/gist:2382775
<?php
/*
echo plural_form(42, array('арбуз', 'арбуза', 'арбузов'));
*/
function plural_form($n, $forms) {
return $n%10==1&&$n%100!=11?$forms[0]:($n%10>=2&&$n%10<=4&&($n%100<10||$n%100>=20)?$forms[1]:$forms[2]);
}
@meniam
meniam / BEM-XJST.md
Created November 16, 2013 18:45 — forked from tadatuta/BEM-XJST.md

BEM-XJST

Это БЭМ-ориентированные хелперы над стандартным XJST-синтаксисом. Сюда входит:

  • синтаксический сахар для подпредикатов про БЭМ предметную область
  • возможность писать вложенные шаблоны
  • синтаксический сахар для apply по какой-то mode (apply(this._mode = 'bla'))
  • ключевое слово applyCtx (синтаксический сахар для applyNext(this.ctx = { some: 'new' }))
Подпредикаты про БЭМ
@meniam
meniam / explode plus list
Created July 24, 2013 14:38
When you use list($a, $b) = explode('delimiter', $str) and in str delimiter doesn't exists php show warning
if (count($segments = explode('By', $method, 2)) == 2) {
list($basePart, $by) = $segments;
} else {
$basePart = $method;
$by = '';
}