Skip to content

Instantly share code, notes, and snippets.

View vikbert's full-sized avatar

Xun Zhou vikbert

View GitHub Profile
@vikbert
vikbert / logstash-symfony2.md
Last active March 29, 2018 14:52
[Logstash] Logstash config for Symfony2 #logstash, #symfony

logstash config


input {
  file {
    # /path/to/APP/app/logs/prod.log
    path => "/srv/*/app/logs/dev.log"
  }  
}
@vikbert
vikbert / gitlab.ci.md
Last active March 29, 2018 15:12
[gitlab] gitlab config #gitlab, #config

gitlab config sample

gitlab.ci.yml

before_script:
    - composer install --prefer-dist > /dev/null
    - export APP_ENV=dev

unitTesting:
 script:
@vikbert
vikbert / shell.sh
Last active July 4, 2018 21:23
[Shell] common used commands and shell snippets #shell, #linux, #command
#!/bin/bash
## switch block
case "$1" in
start)
start
;;
stop)
stop
@vikbert
vikbert / git.md
Last active February 13, 2019 09:50
[git cheatsheet] GIT common used commands #git, #cheatsheet

GitHub

git glossar

git-rebase

reapply all commits from your branch to the TOP of another branch. It will sequentially take all the commmits from the branch you're in, and reapply them to the destination branch. Git-rebase does not destroy the old ones. git rebase

read more git-rebase golden rule

@vikbert
vikbert / deply_callback.sh
Last active March 30, 2018 20:32
[deploy shell] deploy deploy and callback with shell script #shell, #deployment
#!/usr/bin/env bash
ARTIFACTS=shop.tar.gz
TARGET_BASE=/srv/www
TARGET_ARCHIVE=$TARGET_BASE/$ARTIFACTS
TARGET_LOCATION=$TARGET_BASE/shop
case "$1" in
deploy)
echo 'backing up artifacts ...'
@vikbert
vikbert / sql.md
Last active July 12, 2018 21:16
[mysql] sql code snippets #sql, #mysql, #snippet

Koza Queries

-- check error ratio of payments
SELECT
	SUM(IF(success = 1, 1, 0)) AS success,
	SUM(IF(success = 0, 1, 0)) AS error
FROM payment_history
WHERE created_at > DATE_SUB(NOW(), INTERVAL 24 HOUR)
AND fk_payment_data is null
@vikbert
vikbert / atom.md
Last active April 2, 2018 17:07
[atom] atom editor configuration #atom, #editor

Customize vim editor and keymap

I use commonly key combination jk to do quick switch between INSERT/COMMAND mode in vim. The followings are the configurations for the favorite editors.

to allow quick switch INSERT/COMMAND mode in atom with keys jk, two files need to be configured

content in ~/.atom/init.coffee

atom.commands.add 'atom-text-editor', 'exit-insert-mode-if-proceeded-by-j': (e) ->
  editor = @getModel()
  pos = editor.getCursorBufferPosition()
 range = [pos.traverse([0,-1]), pos]
@vikbert
vikbert / symfony.md
Last active April 12, 2018 07:07
[symfony] php snippets in symfony project #symfony, #php, #snippet

generate URLs from ROUTE

// annotation of route
/*
 * @Route("/checkout/address/edit/{id}", name="checkout_address_modify", requirement={"id": "\d+})
 */
public function editAction() {}

/*
@vikbert
vikbert / redis.md
Last active May 27, 2020 06:49
[Redis] redis Guideline #redis

Redis Guideline

The guideline is tested on centOs 7

Enable redis remote access

Check your /etc/redis.conf, and make sure to change the default:

bind 127.0.0.1

to

@vikbert
vikbert / php7.md
Last active April 6, 2019 07:09
[php HowTo] install php 7.1 #web, #web-dev,

show php.ini

php --ini

Interactive PHP debugger

  • install psysh
composer g require psy/psysh:@stable