Skip to content

Instantly share code, notes, and snippets.

// http://drywa.me/2017/07/02/simple-win32-window-with-rust/
#![windows_subsystem = "windows"]
extern crate winapi;
extern crate user32;
extern crate kernel32;
use std::ffi::OsStr;
use std::os::windows::ffi::OsStrExt;
use std::iter::once;
# Install https://www.vaultproject.io/
brew install vault
# Start dev vault server in a separate terminal
vault server -dev
# ==> Vault server configuration:
# ...
# Unseal Key: 7ACQHhLZY5ivzNzhMruX9kSa+VXCah3y87hl3dPSWFk=
# Root Token: 858a6658-682e-345a-e4c4-a6e14e6f7853
@mjgil
mjgil / local-mongo-replicaset-with-docker
Created September 4, 2019 15:44 — forked from simon-contreras-deel/local-mongo-replicaset-with-docker
[Local mongo replicaset with docker] #docker #mongo
# pull the official mongo docker container
docker pull mongo
# create network
docker network create my-mongo-cluster
# create mongos
docker run -d --net my-mongo-cluster -p 27017:27017 --name mongo1 mongo mongod --replSet my-mongo-set --port 27017
docker run -d --net my-mongo-cluster -p 27018:27018 --name mongo2 mongo mongod --replSet my-mongo-set --port 27018
docker run -d --net my-mongo-cluster -p 27019:27019 --name mongo3 mongo mongod --replSet my-mongo-set --port 27019
@mjgil
mjgil / SimpleHTTPServerWithUpload.py
Created September 4, 2019 15:42 — forked from UniIsland/SimpleHTTPServerWithUpload.py
Simple Python Http Server with Upload
#!/usr/bin/env python
"""Simple HTTP Server With Upload.
This module builds on BaseHTTPServer by implementing the standard GET
and HEAD requests in a fairly straightforward manner.
"""
// create a bookmark and use this code as the URL, you can now toggle the css on/off
// thanks+credit: https://dev.to/gajus/my-favorite-css-hack-32g3
javascript: (function() {
var elements = document.body.getElementsByTagName('*');
var items = [];
for (var i = 0; i < elements.length; i++) {
if (elements[i].innerHTML.indexOf('* { background:#000!important;color:#0f0!important;outline:solid #f00 1px!important; background-color: rgba(255,0,0,.2) !important; }') != -1) {
items.push(elements[i]);
}
}
@mjgil
mjgil / git-auto-sign-commits.sh
Created September 4, 2019 15:37 — forked from mort3za/git-auto-sign-commits.sh
Auto sign your git commits
# Generate a new pgp key: (better to use gpg2 instead of gpg in all below commands)
gpg --gen-key
# maybe you need some random work in your OS to generate a key. so run this command: `find ./* /home/username -type d | xargs grep some_random_string > /dev/null`
# check current keys:
gpg --list-secret-keys --keyid-format LONG
# See your gpg public key:
gpg --armor --export YOUR_KEY_ID
# YOUR_KEY_ID is the hash in front of `sec` in previous command. (for example sec 4096R/234FAA343232333 => key id is: 234FAA343232333)
Usage: youtube-dl [OPTIONS] URL [URL...]
Options:
General Options:
-h, --help Print this help text and exit
--version Print program version and exit
-U, --update Update this program to latest version. Make
sure that you have sufficient permissions
(run with sudo if needed)
-i, --ignore-errors Continue on download errors, for example to
All value pairs (f.ex rate and queue size) will be in the UP/DOWN
order. Use the up/down/left/right arrow keys to move between screens.
Usage: rtorrent [OPTIONS]... [FILE]... [URL]...
-h Display this very helpful text
-n Don't try to load ~/.rtorrent.rc on startup
-b <a.b.c.d> Bind the listening socket to this IP
-i <a.b.c.d> Change the IP that is sent to the tracker
-p <int>-<int> Set port range for incoming connections
-d <directory> Save torrents to this directory by default
#!/usr/bin/env bash
for filename in *.mkv
do
echo $filename
# only keep the second subtitle track
mkvpropedit "$filename" --edit track:s1 --set flag-default=0 --edit track:s2 --set flag-default=1
done
youtube-dl Supported sites
Here's is the list of all the supported sites, ordered alphabetically:
1tv: Первый канал
1up.com
20min
220.ro
23video