Skip to content

Instantly share code, notes, and snippets.

View crusat's full-sized avatar

Kuznetsov Aleksey crusat

View GitHub Profile
# Enable this for template generation
Alias /munin /var/www/munin
# Enable this for cgi-based templates
#Alias /munin-cgi/static /var/cache/munin/www/static
#ScriptAlias /munin-cgi /usr/lib/munin/cgi/munin-cgi-html
#<Location /munin-cgi>
# Order allow,deny
# Allow from localhost 127.0.0.0/8 ::1
# AuthUserFile /etc/munin/munin-htpasswd
@crusat
crusat / ContentView.swift
Last active July 20, 2023 06:18
Changable themes in SwiftUI
import SwiftUI
struct Theme: Hashable {
var colorPrimary: Color = Color.primary
var name: String? = nil
var publicName: String = "System"
}
var themes: [Theme] = [
Theme(colorPrimary: Color.primary, name: nil, publicName: "System"),
@crusat
crusat / postgres-cheatsheet.md
Created March 24, 2017 08:34 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

If run with -E flag, it will describe the underlaying queries of the \ commands (cool for learning!).

Most \d commands support additional param of __schema__.name__ and accept wildcards like *.*

@crusat
crusat / gulpfile.js
Last active October 16, 2019 03:52
Gulp Example
// npm i -g gulp
// npm i gulp gulp-uglify gulp-rename gulp-concat gulp-header gulp-minify-css gulp-watch
var gulp = require('gulp'),
uglify = require('gulp-uglify'),
rename = require('gulp-rename'),
concat = require('gulp-concat'),
header = require('gulp-header'),
pkg = require('./package.json'),
minifyCSS = require('gulp-minify-css'),
watch = require('gulp-watch');
@crusat
crusat / TransmitOpenTerminal.txt
Created October 4, 2019 17:34 — forked from johnfmorton/TransmitOpenTerminal.txt
Use Transmit 5 to open in iTerm (instead of Terminal.app) as mentioned here https://library.panic.com/transmit5/open-in-terminal/
on openTerminal(location, remoteHost, serverPort)
tell application "System Events"
-- some versions might identify as "iTerm2" instead of "iTerm"
set isRunning to (exists (processes where name is "iTerm")) or (exists (processes where name is "iTerm2"))
end tell
tell application "iTerm"
activate
set targetTab to ""
@crusat
crusat / .vimrc
Last active February 27, 2018 12:07
" sudo add-apt-repository ppa:jonathonf/vim && sudo apt-get update && apt upgrade -y
" Install Vundle
" Install this .vimrc
" :PluginInstall
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
@crusat
crusat / gist:832d817c43382c8b7b30dc73a282db70
Created February 14, 2017 13:09 — forked from lxneng/gist:741932
install PostgreSQL 9 in Mac OSX via Homebrew
install PostgreSQL 9 in Mac OSX via Homebrew
Mac OS X Snow Leopard
System Version: Mac OS X 10.6.5
Kernel Version: Darwin 10.5.0
Install notes for PostgreSQL 9.0.1 install using Homebrew:
sh-3.2# brew install postgresql
@crusat
crusat / ONPAWD.sh
Created February 10, 2017 09:06
The Perfect Web Server - OpenSSL, Nginx, MySQL (PostgreSQL), Ajenti, Wordpress, Debian 7.x
# This file is zentralized to be a Turorial.
# I'm not sure about the full selfish-work.
# We will isntall OpenSSL,NginX,PostgreSQL.
# Than we will isntall Ajenti.
# Than you must configurate Ajenti to not use SSL (we will changethis later back)
# Followed we install Wordpress and you will have to install some plugins for PSQL and Nginx.
# Ready to press words!
# ----------
#remove instalaltion hardware ofthe sources.list
nano /etc/apt/sources.list
@crusat
crusat / docker_clear.sh
Last active September 3, 2016 08:16
Remove docker containers and images
# Stop all containers
docker stop $(docker ps -a -q)
# Delete all containers
docker rm $(docker ps -a -q)
# Delete all images
<?php
function getPrice($productId) {
$result = '';
$PRICE_TYPE_ID = 1; # just example, see in admin panel
$rsPrices = CPrice::GetList(array(), array('PRODUCT_ID' => $productId, 'CATALOG_GROUP_ID' => $PRICE_TYPE_ID));
if ($arPrice = $rsPrices->Fetch())
{
$result = CurrencyFormat($arPrice["PRICE"], $arPrice["CURRENCY"]);
}
return $result;