Skip to content

Instantly share code, notes, and snippets.

@firstrow
firstrow / dump_all.sh
Created March 31, 2014 06:58
Dumps all databases to separate file
mysql -uroot -pmysqlpass -e 'show databases' | while read dbname; do mysqldump -uroot -pmysqlpass "$dbname" > "$dbname".sql; done
{
"filtered":{
"filter":{
"bool":{
"must":[
{
"bool":{
"should":[
{
"bool":{
@firstrow
firstrow / ssh-copy-id.sh
Created August 29, 2014 13:20
ssh-copy-id analog
cat ~/.ssh/id_rsa.pub | ssh deployer@host "mkdir ~/.ssh; cat >> ~/.ssh/authorized_keys"
#################
#### MODULES ####
#################
$ModLoad imuxsock # provides support for local system logging
$ModLoad imfile
###########################
#### GLOBAL DIRECTIVES ####
###########################
@firstrow
firstrow / es.sh
Last active August 29, 2015 14:06 — forked from rajraj/es.sh
cd ~
sudo yum update
sudo yum install java-1.7.0-openjdk.i686 -y
wget https://github.com/downloads/elasticsearch/elasticsearch/elasticsearch-0.19.9.tar.gz -O elasticsearch.tar.gz
tar -xf elasticsearch.tar.gz
rm elasticsearch.tar.gz
mv elasticsearch-* elasticsearch
sudo mv elasticsearch /usr/local/share
@firstrow
firstrow / gist:76fa235654ef991ae3cf
Last active August 29, 2015 14:12
php: construct
<?php
namespace Core\Db;
/**
* Helps to iterate over huge data collection.
* It loads records by small chunks
*
* Example:
* <pre>
@firstrow
firstrow / helm-mini
Created March 19, 2015 08:31
Helm mini
(setq helm-display-header-line nil) ;; t by default
(set-face-attribute 'helm-source-header nil :height 0.1)
(helm-autoresize-mode 1)
(setq helm-autoresize-max-height 30)
(setq helm-autoresize-min-height 30)
(setq helm-split-window-in-side-p t)
@firstrow
firstrow / es.sh
Last active August 29, 2015 14:18 — forked from Globegitter/es.sh
cd ~
##If you want to install OpenJDK
#sudo apt-get update
#sudo apt-get install openjdk-8-jre-headless -y
###Or if you want to install Oracle JDK, which seems to have slightly better performance
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
@firstrow
firstrow / 0. nginx_setup.sh
Created September 9, 2012 14:25 — forked from mikhailov/0. nginx_setup.sh
Nginx+Unicorn
# Nginx+Unicorn best-practices congifuration guide.
# We use latest stable nginx with fresh **openssl**, **zlib** and **pcre** dependencies.
# Some extra handy modules to use: --with-http_stub_status_module --with-http_gzip_static_module
#
# Deployment structure
#
# SERVER:
# /etc/init.d/nginx (1. nginx)
# /home/app/public_html/app_production/current (Capistrano directory)
#
@firstrow
firstrow / api.go
Last active October 14, 2015 17:24
Sample API
func main() {
app := NewApplication("development.toml")
app.Start(":8080")
}
type Application struct {
Config *tomlConfig
PagesController *ControllerInterface
PagesStorage *StorageInterface
UsersStorage *StorageInterface