Skip to content

Instantly share code, notes, and snippets.

Avatar
👨‍🔧

Skrip42 Skrip42

👨‍🔧
  • centra
  • Russia, Novokuznetsk
View GitHub Profile
View select-top-n-for-each-group.sql
set @num := 0, @type := '';
select type, variety, price
from (
select type, variety, price,
@num := if(@type = type, @num + 1, 1) as row_number,
@type := type as dummy
from fruits
order by type, price
) as x where x.row_number <= 2;
@Skrip42
Skrip42 / dbf2sql.py
Created Oct 7, 2020
dbf to sql converter
View dbf2sql.py
#!/usr/bin/python
import sys
from simpledbf import Dbf5
filename = sys.argv[1]
dbf = Dbf5(filename, codec='cp866')
dbf.to_textsql(filename.replace('DBF', 'sql'), filename.replace('DBF','csv'))
View pagemap.yaml
parameters:
pagemap:
home:
title: 'Главная'
nav: false
route: 'home'
childs:
login:
title: 'Логин'
nav: false
View PageMap.php
<?php
namespace App\Services;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\ContainerInterface;
use WhiteOctober\BreadcrumbsBundle\Model\Breadcrumbs;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\Routing\RouterInterface;
use Symfony\Component\Security\Core\Security;
@Skrip42
Skrip42 / phpdoc.shippet
Created Sep 26, 2019
php docblock for ultisnips
View phpdoc.shippet
global !p
import os
def readconf():
conf = dict(phpversion='7', package = '', author = '', license = '', link = '')
pwd = os.getcwd()
if os.path.isfile(pwd + '/.usrc') != True:
return dict()
conff = open(pwd + '/.usrc', 'r')
data = conff.read().split('\n')
for i in range(0, len(data)):
@Skrip42
Skrip42 / install-vim-8-with-python-ruby-lua-opensuse.sh
Last active Oct 1, 2020 — forked from erickpatrick/install-vim-8-with-python-ruby-lua-ubuntu.sh
Install Vim 8 with Python, Python 3, Ruby (2.5) and Lua support on openSuse
View install-vim-8-with-python-ruby-lua-opensuse.sh
# remove current vim
sudo zypper rm vim vim-runtime vim-gnome vim-tiny vim-gui-common
# removes current link for vim
sudo rm -rf /usr/local/share/vim /usr/bin/vim
sudo zypper addrepo https://download.opensuse.org/repositories/home:ochaton/openSUSE_Tumbleweed/home:ochaton.repo
sudo zypper refresh
# installs everything needed to make/configure/build Vim