Skip to content

Instantly share code, notes, and snippets.

View skvoz's full-sized avatar

Perevozchykov Kostiantyn skvoz

View GitHub Profile
// This will open up a prompt for text to send to a console session on digital ocean
// Useful for long passwords
(function () {
var t = prompt("Enter text to be sent to console, (This wont send the enter keystroke)").split("");
function f() {
var character = t.shift();
var i=[];
var code = character.charCodeAt();
var needs_shift = "!@#$%^&*()_+{}:\"<>?~|".indexOf(character) !== -1
@skvoz
skvoz / mysql-docker.sh
Created June 19, 2018 06:15 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@skvoz
skvoz / introrx.md
Created November 20, 2016 21:43 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
server {
server_name domain.tld www.domain.tld;
root /var/www/project/web;
location / {
# try to serve file directly, fallback to app.php
try_files $uri /app.php$is_args$args;
}
# DEV
# This rule should only be placed on your development environment
@skvoz
skvoz / gist:219baa3eee76bee79c3c
Created August 31, 2015 07:28
js example oop
var account = {
warehouseId: 'warId',
warehouseHandler: function(){
this.warehouseId.on('click',funciton(){})
}
};
$(funciton(){
account.warehouseHandler();
})
@skvoz
skvoz / gist:dbdf0907fa864af9a496
Created July 3, 2015 07:40
query language Querying Elasticsearch
{
size: # number of results to return (defaults to 10)
from: # offset into results (defaults to 0)
fields: # list of document fields that should be returned - http://elasticsearch.org/guide/reference/api/search/fields.html
sort: # define sort order - see http://elasticsearch.org/guide/reference/api/search/sort.html
query: {
# "query" object following the Query DSL: http://elasticsearch.org/guide/reference/query-dsl/
# details below
},
@skvoz
skvoz / gist:3fe365cad29a02855322
Created July 2, 2015 11:34
extended urlmanager in yii2
<?php
namespace frontend\components;
use yii\web\UrlManager;
use common\models\Lang;
class LangUrlManager extends UrlManager
{
public function createUrl($params)
{
@skvoz
skvoz / gist:2f9423ccff1b706570db
Created June 8, 2015 14:02
Mac OS X : Adding user groups and assigning read/write permission for the group to specific folder
//Adds new user group "dev" using Mac directory service command line utility
sudo dscl . -create /groups/dev
//Assigns some group id for the newly created group
sudo dscl . -append /groups/dev gid 2111
//Assigns password for the group
sudo dscl . -append /groups/dev passwd "xxxxx"
@skvoz
skvoz / gist:233ec32096dfb0304a08
Created May 6, 2015 13:22
yii2 IDE autocompletion for custom components
<?php
/**
* Yii bootstrap file.
* Used for enhanced IDE code autocompletion.
*/
class Yii extends \yii\BaseYii
{
/**
* @var BaseApplication|WebApplication|ConsoleApplication the application instance
*/
# Created Tue May 5 13:28:50 EEST 2015
<VirtualHost *:80>
DocumentRoot "/Users/md101/Sites/business-card.local/frontend/web"
ServerName business-card.local
#ServerAlias your.alias.here
ScriptAlias /cgi-bin "/Users/md101/Sites/business-card.local/cgi-bin"
<Directory "/Users/md101/Sites/business-card.local/frontend/web">
Options All
AllowOverride All