Skip to content

Instantly share code, notes, and snippets.

View Loopshape's full-sized avatar
🏠
Hunting my achieved Bitcoin

loop.core Loopshape

🏠
Hunting my achieved Bitcoin
View GitHub Profile
@Loopshape
Loopshape / gist:e612a025abe8a1f4e396d62ba72b8ad0
Created April 12, 2021 19:56 — forked from eviltester/gist:7beef92896fdd8b638656f996fac38c0
Convert videos into subtitled sections using ffmpeg
# Create a new caption file
~~~~~~~~
ffmpeg -i captions.srt captions.ass
~~~~~~~~
# Add subtitles to main video without changing it
~~~~~~~~
ffmpeg -i video.mp4 -vf "subtitles=captions.ass:force_style='OutlineColour=&H80000000,BorderStyle=4,Outline=1,Shadow=0,MarginV=20'" subtitled-video.mp4
@Loopshape
Loopshape / setup.sh
Created November 8, 2019 01:54 — forked from jjvillavicencio/setup.sh
Install Android SDK on Windows Bash (WSL)
cd /home/<user>/
sudo apt-get install unzip
wget https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip
unzip sdk-tools-linux-4333796.zip -d Android
rm sdk-tools-linux-4333796.zip
sudo apt-get install -y lib32z1 openjdk-8-jdk
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
export PATH=$PATH:$JAVA_HOME/bin
printf "\n\nexport JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64\nexport PATH=\$PATH:\$JAVA_HOME/bin" >> ~/.bashrc
cd Android/tools/bin
@Loopshape
Loopshape / miui-instagram-video-encoding-fix.md
Created November 26, 2018 08:31
Splitting, cropping and converting video for Instagram

Short description

Just a short reminder to self, when i'll be struggling with uploading video to Instagram. For some reason my MIUI v5 port has troubles with recording proper video to be successfully uploaded to Instagram.

First of all: encoding should be mpeg4, not h264!, regardless of file extension (but should probably be mp4).

All the options passed to ffmpeg are order dependant: first options executed first, last will override previous. Thus, input file is defined early, output file is defined at the very end.

All filters can be setup per stream (a for audio and v for video) and should be defined as -filter (for both),

// Create a client AF_UNIX socket
#define SERVER_ADDRESS “/mnt/c/unix/server.sock”
SOCKADDR_UN ServerAddress = {0};
Client = socket(AF_UNIX, SOCK_STREAM, 0);
// Bind the socket to a path.
ServerAddress.sun_family = AF_UNIX;
strcpy(ServerAddress.sun_path, SERVER_ADDRESS);
connect(Client, &ServerAddress, sizeof(ServerAddress));
// Create a server AF_UNIX socket
#define SERVER_ADDRESS “c:\unix\server.sock”
SOCKADDR_UN ServerAddress = {0};
Server = socket(AF_UNIX, SOCK_STREAM, 0);
// Bind the socket to a path.
ServerAddress.sun_family = AF_UNIX;
strcpy(ServerAddress.sun_path, SERVER_ADDRESS);
bind(Server, &ServerAddress, sizeof(ServerAddress));
goto :start
:x
@set "redir="
@set "args=%*"
@set "a=%1"
@if "%a:~0,5%" == "/out:" (
@set "redir=> %a:~5%"
@shift
@Loopshape
Loopshape / fix.sh
Created October 28, 2017 16:23 — forked from jeffersfp/fix.sh
dpkg: warning: files list file for package `*****' missing, assuming package has no files currently installed
#!/bin/bash
set -e
# Clean out /var/cache/apt/archives
apt-get clean
# Fill it with all the .debs we need
apt-get --reinstall -dy install $(dpkg --get-selections | grep '[[:space:]]install' | cut -f1)
DIR=$(mktemp -d -t info-XXXXXX)
for deb in /var/cache/apt/archives/*.deb
# 1. Import library of functions
import tflearn
# 2. Logical OR operator / the data
OR = [[0., 0.], [0., 1.], [1., 0.], [1., 1.]]
Y_truth = [[0.], [1.], [1.], [1.]]
# 3. Building our neural network/layers of functions
neural_net = tflearn.input_data(shape=[None, 2])
neural_net = tflearn.fully_connected(neural_net, 1, activation='sigmoid')
neural_net = tflearn.regression(neural_net, optimizer='sgd', learning_rate=2, loss='mean_square')
# 4. Train the neural network / Epochs
@Loopshape
Loopshape / bash-cheatsheet.sh
Created June 8, 2017 08:20 — forked from LeCoupa/bash-cheatsheet.sh
Bash CheatSheet for UNIX Systems
#!/bin/bash
#####################################################
# Name: Bash CheatSheet for Mac OSX
#
# A little overlook of the Bash basics
#
# Usage:
#
# Author: J. Le Coupanec
# Date: 2014/11/04
@Loopshape
Loopshape / debian-install-zram.sh
Created May 28, 2017 13:15
Install zRAM on Debian(8)
#!/bin/bash
#
not_root() {
echo "ERROR: You have to be root to execute this script"
exit 1
}
zram_exists() {
echo "ERROR: /etc/init.d/zram already exists"