Skip to content

Instantly share code, notes, and snippets.


Kuznetsov Aleksey crusat

View GitHub Profile
crusat / ContentView.swift
Last active Apr 11, 2021
Changable themes in SwiftUI
View ContentView.swift
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 / TransmitOpenTerminal.txt
Created Oct 4, 2019 — forked from johnfmorton/TransmitOpenTerminal.txt
Use Transmit 5 to open in iTerm (instead of as mentioned here
View TransmitOpenTerminal.txt
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"
set targetTab to ""
crusat /
Created Mar 24, 2017 — forked from Kartones/
PostgreSQL command line cheatsheet


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 / gist:832d817c43382c8b7b30dc73a282db70
Created Feb 14, 2017 — forked from lxneng/gist:741932
install PostgreSQL 9 in Mac OSX via Homebrew
View gist:832d817c43382c8b7b30dc73a282db70
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 /
Created Feb 10, 2017 — forked from Yaksinikos/
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
View bitrix_price.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;
# Memory, CPU, etc
# example:
# gitlab_web_1 0.77% 1.046 GiB / 1.955 GiB 53.50% 196.4 kB / 1.907 MB 23.02 MB / 2.769 MB 0
# command:
docker stats $(docker ps|grep -v "NAMES"|awk '{ print $NF }'|tr "\n" " ")
crusat /
Last active Sep 3, 2016
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
View .bashrc
PS1="\e[2m[\t]\e[0m \u@\h \e[93m\w\e[0m \$ "
View munin-apache.conf
# 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 ::1
# AuthUserFile /etc/munin/munin-htpasswd