Skip to content

Instantly share code, notes, and snippets.

@mastdiekin
mastdiekin / non_graceful_shutdown.py
Created April 3, 2023 01:05 — forked from clchiou/non_graceful_shutdown.py
Python ThreadPoolExecutor (non-)graceful shutdown
#!/usr/bin/env python3
import concurrent.futures.thread
import sys
import time
from concurrent.futures import ThreadPoolExecutor, as_completed
def remove_file(path):
print('Removing file %s' % path)
@mastdiekin
mastdiekin / ffmpeg-watermark.md
Created June 27, 2022 16:14 — forked from bennylope/ffmpeg-watermark.md
FFmpeg add a watermark to video

How to Add a Watermark to Video

FFMPEG filters provide a powerful way to programmatically enhance or alter videos, and it’s fairly simple to add a watermark to a video using the overlay filter. The easiest way to install ffmpeg is to download a pre-built binary for your specific platform. Then you don’t have to worry about including and installing all the right dependencies and codecs you will be using.

Once you have ffmpeg installed, adding a watermark is as easy as passing your existing source through an overlay filter like so:

ffmpeg -i test.mp4 -i watermark.png -filter_complex "overlay=10:10" test1.mp4

Basically, we’re passing in the original video, and an overlay image as inputs, then passing it through the filter, and saving the output as test1.mp4.

version: '2.1'
services:
php:
tty: true
build:
context: .
dockerfile: tests/Docker/Dockerfile-PHP
args:
version: cli
volumes:
@mastdiekin
mastdiekin / SSH.py
Created January 8, 2022 04:45 — forked from vladwa/SSH.py
Python code to execute command as a sudo user over ssh connection on a remote server using "paramiko" module. On The code snippet establishes connection and executes the command and return the status and output of the executed command.
import logging
import paramiko
class SSH:
def __init__(self):
pass
def get_ssh_connection(self, ssh_machine, ssh_username, ssh_password):
"""Establishes a ssh connection to execute command.
:param ssh_machine: IP of the machine to which SSH connection to be established.
@mastdiekin
mastdiekin / next_nginx.md
Created September 21, 2021 19:01 — forked from kocisov/next_nginx.md
How to setup next.js app on nginx with letsencrypt
@mastdiekin
mastdiekin / web-servers.md
Created September 14, 2021 17:56 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@mastdiekin
mastdiekin / App.js
Created July 16, 2021 14:53 — forked from shelldandy/App.js
nprogress with react-router in create-react-app
import React from 'react'
import { BrowserRouter as Router, Switch } from 'react-router-dom'
import routes from './routes'
import FancyRoute from './components/tools/FancyRoute'
const App = props =>
<Router>
<Switch>
{routes.map((route, i) =>
<FancyRoute key={i} {...route} />
@mastdiekin
mastdiekin / _app.js
Created July 6, 2021 23:27 — forked from claus/_app.js
Restore scroll position after navigating via browser back/forward buttons in Next.js
import useScrollRestoration from "utils/hooks/useScrollRestoration";
const App = ({ Component, pageProps, router }) => {
useScrollRestoration(router);
return <Component {...pageProps} />;
};
export default App;
@mastdiekin
mastdiekin / README.md
Created April 15, 2021 11:00 — forked from guillaumevincent/README.md
Windows Service with Python 3.5 and pyinstaller
@mastdiekin
mastdiekin / cat.jpg
Created March 18, 2021 13:08 — forked from duhaime/cat.jpg
Color thief top colors
cat.jpg