Skip to content

Instantly share code, notes, and snippets.

@umanshield
umanshield / ubuntu_agnoster_install.md
Created January 19, 2020 22:07 — forked from renshuki/ubuntu_agnoster_install.md
Ubuntu 16.04 + Terminator + Oh My ZSH with Agnoster Theme

Install Terminator (shell)

sudo add-apt-repository ppa:gnome-terminator
sudo apt-get update
sudo apt-get install terminator

Terminator should be setup as default now. Restart your terminal (shortcut: "Ctrl+Alt+T").

Install ZSH

@umanshield
umanshield / dont-prompt-$USER-for-password
Created December 16, 2019 18:36
To never prompt the current user for a password when that user uses sudo do. https://askubuntu.com/a/1162819/589138
echo "$USER ALL=(ALL:ALL) NOPASSWD: ALL" | sudo tee /etc/sudoers.d/dont-prompt-$USER-for-password
@umanshield
umanshield / datetime.php
Created September 2, 2019 09:26 — forked from graste/datetime.php
PHP DateTime class – parsing and formatting ISO8601 dates with or w/o fractions of a second
<?php
echo 'default locale: ' . \Locale::getDefault();
echo PHP_EOL;
echo 'default timezone: ' . \date_default_timezone_get();
echo PHP_EOL;
// see http://tools.ietf.org/html/rfc3339#section-5.8 for example datetimes
// bug report on missing fractions support: https://bugs.php.net/bug.php?id=51950
// feature request for fractions support in constructor: https://bugs.php.net/bug.php?id=49779
@umanshield
umanshield / compose.js
Created July 18, 2019 20:04 — forked from kirpalmakanga/compose.js
Async Compose & Pipe
const asyncCompose = (…functions) => input => functions.reduceRight((chain, func) => chain.then(func), Promise.resolve(input));
const asyncPipe = (…functions) => input => functions.reduce((chain, func) => chain.then(func), Promise.resolve(input));
@umanshield
umanshield / a connect.bash
Last active December 21, 2020 10:29
symfony postgress create database
$ sudo -u postgres psql
psql (11.2 (Ubuntu 11.2-1.pgdg16.04+1))
Type "help" for help.
postgres=# CREATE USER database_name CREATEDB ENCRYPTED PASSWORD 'CHANGE_ME';
Список ролей(пользователи)
postgres=# \dg;
Role name | Attributes | Member of
-----------------+------------------------------------------------------------+-----------
RewriteEngine On
# If an existing asset or directory is requested go to it as it is
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f [OR]
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -d
RewriteRule ^ - [L]
# If the requested resource doesn't exist, use index.html
RewriteRule ^ /index.html
@umanshield
umanshield / letsencyrpt_flask.py
Last active March 11, 2019 16:32 — forked from saucecode/my_flask_program.py
how to correctly use a letsencrypt cert with flask
if __name__ == '__main__':
app.run(host="0.0.0.0", port=8080, ssl_context=('/etc/letsencrypt/live/<DOMAIN>/fullchain.pem', '/etc/letsencrypt/live/<DOMAIN>/privkey.pem'))
@umanshield
umanshield / publish_project.sh
Created March 4, 2019 15:55
Publish public folder
#!/bin/bash
public='/var/www/html/'$1;
pwd=$(pwd);
sudo ln -s $pwd $public
echo '✔ Проект успешно опубликован в: '$public;
@umanshield
umanshield / command.sh
Last active January 27, 2019 17:28
Typescript
# watch file
tsc -w --outDir ./build "test.ts"
@umanshield
umanshield / modify.js
Created January 24, 2019 13:05
javascript date
var myDate = new Date();
//add a day to the date
myDate.setDate(myDate.getDate() + 1);