Skip to content

Instantly share code, notes, and snippets.

@vdv
vdv / bot.rb
Created December 28, 2022 11:31 — forked from dideler/bot.rb
Sending a notification message to Telegram using its HTTP API via cURL
# Use this script to test that your Telegram bot works.
#
# Install the dependency
#
# $ gem install telegram_bot
#
# Run the bot
#
# $ ruby bot.rb
#
@vdv
vdv / Service KMS
Created December 11, 2022 10:30 — forked from judero01col/Service KMS
Volume License Activation Key Service - KMS
## Find Available Target Editions
DISM.exe /Online /Get-TargetEditions
## Convert Server Standard 2019 Evaluation to Server Standard 2019
DISM /online /Set-Edition:ServerStandard /ProductKey:N69G4-B89J2-4G8F4-WWYCC-J464C /AcceptEula
## How To Activate
slmgr /ipk XXXXX-XXXXX-XXXXX-XXXXX-XXXXX
slmgr /skms [server]:[port]
slmgr /ato
@vdv
vdv / 2019-https-localhost.md
Created June 4, 2020 20:41 — forked from cecilemuller/2019-https-localhost.md
How to create an HTTPS certificate for localhost domains

How to create an HTTPS certificate for localhost domains

This focuses on generating the certificates for loading local virtual hosts hosted on your computer, for development only.

Do not use self-signed certificates in production ! For online certificates, use Let's Encrypt instead (tutorial).

@vdv
vdv / vimeo-downloader.js
Created October 15, 2019 09:51 — forked from mistic100/vimeo-downloader.js
Download video from Vimeo (chopped m4s files)
// 1. Open the browser developper console on the network tab
// 2. Start the video
// 3. In the dev tab, locate the load of the "master.json" file, copy its full URL
// 4. Run: node vimeo-downloader.js "<URL>"
// 5. Combine the m4v and m4a files with mkvmerge
const fs = require('fs');
const url = require('url');
const https = require('https');
@vdv
vdv / clean-up-boot-partition-ubuntu.md
Created September 3, 2019 06:58 — forked from ipbastola/clean-up-boot-partition-ubuntu.md
Safest way to clean up boot partition - Ubuntu 14.04LTS-x64, Ubuntu 16.04LTS-x64

Safest way to clean up boot partition - Ubuntu 14.04LTS-x64, Ubuntu 16.04LTS-x64

Reference

Case I: if /boot is not 100% full and apt is working

1. Check the current kernel version

$ uname -r 
@vdv
vdv / net-http-debug.rb
Created July 23, 2018 13:51 — forked from ahoward/net-http-debug.rb
a simple way to debug tons of libs that use ruby's net/http
BEGIN {
require 'net/http'
Net::HTTP.module_eval do
alias_method '__initialize__', 'initialize'
def initialize(*args,&block)
__initialize__(*args, &block)
@vdv
vdv / with_active_support.rb
Created June 8, 2018 06:05 — forked from mbyczkowski/with_active_support.rb
session cookie decrypter for Rails 4.2+
require 'cgi'
require 'json'
require 'active_support'
def verify_and_decrypt_session_cookie(cookie, secret_key_base)
cookie = CGI::unescape(cookie)
salt = 'encrypted cookie'
signed_salt = 'signed encrypted cookie'
key_generator = ActiveSupport::KeyGenerator.new(secret_key_base, iterations: 1000)
secret = key_generator.generate_key(salt)[0, ActiveSupport::MessageEncryptor.key_len]
@vdv
vdv / logrotate_rails_site
Created December 22, 2014 18:42
logrotate rails logs
/home/deployer/site/shared/log/nginx-*.log {
weekly
missingok
rotate 10
compress
delaycompress
notifempty
create 0640 deployer deployer
postrotate
[ ! -f /var/run/nginx.pid ] || kill -USR1 `cat /var/run/nginx.pid`
#!/usr/bin/env bash
DUMP_PATH="/var/backup/mysql"
DB_NAME="db_name"
USER="backup"
PASSWORD="pass"
mysqldump -u$USER -p$PASSWORD $DB_NAME | gzip -c > $DUMP_PATH/$DB_NAME.$(date +'%s').sql.gz
cd $DUMP_PATH
rm -f $(ls -1t $DUMP_PATH | tail -n +200)
#!/usr/bin/env bash
DUMP_PATH="/var/backup/mysql"
DB_NAME="db_name"
USER="backup"
PASSWORD="pass"
mysqldump -u$USER -p$PASSWORD $DB_NAME | gzip -c > $DUMP_PATH/$DB_NAME.$(date +'%s').sql.gz
cd $DUMP_PATH
rm -f $(ls -1t $DUMP_PATH | tail -n +200)