Skip to content

Instantly share code, notes, and snippets.

View evgeniidatsiuk's full-sized avatar
🦸‍♂️
IT Iron Man

Yevhenii Datsiuk evgeniidatsiuk

🦸‍♂️
IT Iron Man
View GitHub Profile
@evgeniidatsiuk
evgeniidatsiuk / guide.md
Last active April 18, 2024 10:39
Automate Gmail Cleanup: Delete Old Emails Using Google Apps Script and JavaScript // How to remove all emails from gmail // Gmail: delete old emails automatically // Automatically deletes old emails that match the specified label.

How to Remove Old Emails from Gmail Automatically

Step 1: Login and Create a Project on Google Apps Script

Go to https://script.google.com/ and sign in with your Google account. Then, create a new project.

Step 2: Run the Script

Copy and paste the following script into your Google Apps Script editor:

function gen_ssl_cert {
local prefix="${1}"
openssl genrsa -des3 -out "${prefix}.lock.key" 1024
openssl rsa -in "${prefix}.lock.key" -out "${prefix}.key"
rm "${prefix}.lock.key"
openssl req -new -key "${prefix}.key" -out "${prefix}.csr"
openssl x509 -req -days 3650 -in "${prefix}.csr" -signkey "${prefix}.key" -out "${prefix}.crt"
openssl pkcs12 -export -inkey "${prefix}.key" -in "${prefix}.crt" -out "${prefix}.pfx"
@evgeniidatsiuk
evgeniidatsiuk / Nginx
Created February 16, 2020 21:30 — forked from YarikST/Nginx
#acme
location ^~/.well-known {
default_type "text/plain";
root /var/www/html;
}
events {
worker_connections 768; #10000 Load balancer
multi_accept on;
}
#Load balancer redirect http to https and http to www-version
@evgeniidatsiuk
evgeniidatsiuk / registrations_controller.rb
Created December 29, 2019 22:31 — forked from jwo/registrations_controller.rb
API JSON authentication with Devise
class Api::RegistrationsController < Api::BaseController
respond_to :json
def create
user = User.new(params[:user])
if user.save
render :json=> user.as_json(:auth_token=>user.authentication_token, :email=>user.email), :status=>201
return
else
@evgeniidatsiuk
evgeniidatsiuk / google_maps
Created December 24, 2019 15:39
Google Maps
google api key - https://developers.google.com/maps/documentation/javascript/get-api-key
doc - https://github.com/tomchentw/react-google-maps
//--authorization
import React from "react"
import { compose, withProps } from "recompose"
import { withScriptjs, withGoogleMap } from "react-google-maps"
export default Map =>
compose(
@evgeniidatsiuk
evgeniidatsiuk / redis
Last active December 24, 2019 14:29
Redis
#https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-redis-on-ubuntu-16-04
#https://www.linode.com/docs/databases/redis/how-to-install-a-redis-server-on-ubuntu-or-debian8/
#https://aws-labs.com/configure-redis-cluster-ubuntu-14-04/
sudo apt-get update
sudo apt-get install build-essential tcl
cd /tmp
curl -O http://download.redis.io/redis-stable.tar.gz
tar xzvf redis-stable.tar.gz
cd redis-stable
make
@evgeniidatsiuk
evgeniidatsiuk / deploy
Created December 24, 2019 14:24
Deploy
. Update system
sudo apt update -y && sudo apt upgrade -y && sudo apt full-upgrade -y
. Install standart
sudo apt-get install -y libmagickwand-dev imagemagick ffmpeg libpq-dev htop curl git gem gnupg build-essential
*node.js(auto install npm) - https://nodejs.org/en/download/package-manager
curl -sL https://deb.nodesource.com/setup_9.x | sudo -E bash -
sudo apt-get install -y nodejs
sudo ln -sf /usr/bin/nodejs /usr/local/bin/node
. Install Rvm with Ruby and standart configureted
sudo gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB