Skip to content

Instantly share code, notes, and snippets.

Alexander saniaky

Block or report user

Report or block saniaky

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
saniaky /
Last active Aug 8, 2019 — forked from DavidBuchanan314/
Panopto video downloader
import os
import requests
import youtube_dl
Place the values in the following variable
TOKEN = "..."
saniaky /
Last active Apr 9, 2019
Automatic backup of all MySQL databases to AWS S3 + restore script that downloads latest backup and imports it
  1. Create S3 bucket db-backup
  2. Specify Expire Policty to remove old backups
    Open Bucket Settings -> Management -> Add lifecycle rule -> Expiration tab
    Select Expire current version of object. Use 30 days.
    Select Permanently delete previous versions. Use 1 day.
  3. Create user db-backup-user, assign inline permission policy:
        "Version": "2012-10-17",
        "Statement": [
saniaky /
Last active Aug 26, 2019
Backup and restore a ALL MySQL databases from a running Docker MySQL container.
# Backup
docker exec $CONTAINER sh -c \
'mysqldump --all-databases --quick --single-transaction --skip-lock-tables --flush-privileges -uroot -p"$MYSQL_ROOT_PASSWORD"' \
| gzip > ./backup.sql.gz
# Restore
gunzip ./backup.sql.gz
cat backup.sql | docker exec -i $CONTAINER sh -c 'mysql -uroot -p"$MYSQL_ROOT_PASSWORD"'
saniaky / custom_proxy_settings.conf
Last active Dec 1, 2018
Docker + Wordpress + Nginx Proxy + Let's encrypt + Watcher
View custom_proxy_settings.conf
client_max_body_size 64m;
saniaky / instructions.txt
Last active Dec 1, 2018
Initial Server Setup CentOS + Docker
View instructions.txt
# ============ Create separate user ============
local$ ssh root@server_ip_address
# adduser username
# passwd username
# usermod -aG wheel username
# ============ Copy your SSH key to server ============
saniaky / YoutubeVimeoUrlParser.js
Last active Oct 21, 2018 — forked from yangshun/youtube-vimeo-url-parser.js
YouTube Vimeo URL Parser ES6 Class
View YoutubeVimeoUrlParser.js
class YoutubeVimeoUrlParser {
* Creates an instance of YoutubeVimeoUrlParser.
* @constructor
* @this {YoutubeVimeoUrlParser}
constructor() {
this.pattern = /(http:|https:|)\/\/(player.|www.)?(vimeo\.com|youtu(be\.com|\.be|be\.googleapis\.com))\/(video\/|embed\/|watch\?v=|v\/)?([A-Za-z0-9._%-]*)(&\S+)?/;
saniaky / package.json
Last active Sep 1, 2018
Reverse proxy server for API + create-react-app (CRA)
View package.json
"name": "test",
"version": "0.1.0",
"private": true,
"scripts": {
"app": "concurrently \"node proxy-middleware.js\" \"npm start\"",
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
saniaky /
Created Dec 5, 2017
Example of using message resources in Spring Boot service layer code, in as simple way.
import org.springframework.context.MessageSource;
import org.springframework.stereotype.Component;
import java.util.Locale;
* @author saniaky
* @since 12/5/17
saniaky /
Last active Nov 28, 2017
How to logout (revoke token + refresh token) user in Spring Security using OAuth 2.0
public class TokenController {
private final TokenStore tokenStore;
public TokenController(TokenStore tokenStore) {
this.tokenStore = tokenStore;
saniaky / gist:7acfeb88746e4d6acc7624d3c5f50886
Last active Nov 28, 2017
Create MySQL database in utf8
View gist:7acfeb88746e4d6acc7624d3c5f50886
=======> Create database
CREATE DATABASE db_name CHARACTER SET utf8 COLLATE utf8_general_ci;
You can’t perform that action at this time.