Skip to content

Instantly share code, notes, and snippets.

@aliaksandr-s
aliaksandr-s / send_mail.sh
Created May 22, 2019
Bash curl send email
View send_mail.sh
## Email settings
smtp_server="smtps://smtp.gmail.com:465"
from_email="from-email@gmail.com"
user_acc="from-email@gmail.com"
user_pass="pass"
mail_subject="Subject"
login_url="reset-link"
mail_template_text="Hello!\n Please use this link to set a new password.\n ${login_url} \n"
View vscode-node-debug
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Debugg by PID",
"type": "node",
"processId": "43776",
View bash-aliases
alias robo='/home/user/Загрузки/robomongo-0.9.0-linux-x86_64-0786489/bin/robomongo'
alias d='cd ~; cd Desktop'
alias sht='gnome-screenshot --interactive'
alias krak='setsid /usr/share/gitkraken/gitkraken'
alias goog='setsid /usr/bin/google-chrome-stable'
alias ngrok='cd ~/Downloads; ./ngrok'
alias wk='cd ~/Desktop/work'
# Git
alias gad='git add'
@aliaksandr-s
aliaksandr-s / docker-tips.txt
Last active Jan 8, 2018
Useful docker tips
View docker-tips.txt
// Remove all the containers that end with '_data':
docker rm $(docker ps -a | grep "_data" | awk 'NR>1 {print $1}')
// show and remove all unused data volumes
docker volume ls -qf dangling=true
docker volume rm $(docker volume ls -qf dangling=true)
View subscr.js
// user
const User = (age, name) => (msg) => {
const state = [age, name];
return msg(state)
}
const getAge = (arr) => arr[0];
const getName = (arr) => arr[1];
const getInfo = (arr) => `${arr[0]} ${arr[1]}`;
@aliaksandr-s
aliaksandr-s / .js
Last active Nov 23, 2017
isPalindrome function
View .js
let str = "А по морде ведром - опа!";
const isPalindrome = (str) => {
const getLetter = (n, list) => {
return list[n].toLowerCase();
}
const helper = (firstNum, lastNum, list) => {
const testExp = /[^a-zA-Za-яА-Я]/;
View gist:083ad264a398de865e4b9454aee16451
# colors
COLOR_YELLOW=`echo -e "\033[0;33m"`
COLOR_GREEN=`echo -e "\033[01;32m"`
COLOR_BLUE=`echo -e "\033[01;34m"`
COLOR_WHITE=`echo -e "\033[0;37m"`
COLOR_RESET=`echo -e "\033[00m"`
# Show git repo status
export GIT_PS1_SHOWDIRTYSTATE=1
View Mongo
# Dump
mongodump --db somedb
# Restore the training database to a new database called training2
mongorestore --db training2 dump/training
View gist:96ba92a28b278d0b3082c0f6a8662360
mogrify -quality 80% *.jpg
-----script----
for file in *.jpg; do
convert "$file" -quality 80% "$file"
done;