Skip to content

Instantly share code, notes, and snippets.

@Pouya-moh
Pouya-moh / python-virtualenv
Created April 22, 2019 11:38
Python virtualenv
# creating the env
$ virtualenv --no-site-packages -p /path/to/python3 virtualenv_name
## --no-site-packages seems to be depricated as said here:
## https://virtualenv.pypa.io/en/stable/reference/#cmdoption-no-site-packages
## mind PYTHONPATH and pip -E, and to freez system pip:
## https://stackoverflow.com/questions/1382925/virtualenv-no-site-packages-and-pip-still-finding-global-packages
# activate/de
$ source virtualenv_name/bin/activate
@Pouya-moh
Pouya-moh / emacs
Last active February 3, 2019 15:16
Bootstraping new install
https://github.com/Pouya-moh/.emacs.d.git ~/.emacs.d
cd ~/.emacs.d && mkdir etc && cd etc
git clone https://github.com/Pouya-moh/yamt-theme.git
git clone https://github.com/targzeta/move-lines.git
@Pouya-moh
Pouya-moh / ping-in-loop
Created November 14, 2018 13:53
ping all addresses in current subnet in loop instead of ping -b
$ time ( s=192.168.0 ; for i in $(seq 1 254) ; do ( ping -n -c 1 -w 1 $s.$i 1>/dev/null 2>&1 && printf "%-16s %s\n" $s.$i responded ) & done ; wait ; echo )
## credit: https://superuser.com/a/487014/195348
#
# Copyright (C) 2016 Cogimon
# Author: Enrico Mingo Hoffman
# email: [email protected]
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# reduce file size and remove audio (-an removes audio)
$ ffmpeg -i input.mp4 -vcodec h264 -acodec mp2 output.mp4
# split mp3
$ ffmpeg -i source.mp3 -acodec copy -ss START_TIME -to END_TIME LITTLE_FILE
# e.g. ffmpeg -i source.mp3 -acodec copy -ss 09:29 -to 14:56 03_some_name.mp3
# for equal part:
$ ffmpeg -i somefile.mp3 -f segment -segment_time SECONDS_AS_INT -c copy out%03d.mp3
# converting MTS to mp4