Skip to content

Instantly share code, notes, and snippets.

View flashfoxter's full-sized avatar
🏠
Working from home

Konstantin Le flashfoxter

🏠
Working from home
View GitHub Profile
@flashfoxter
flashfoxter / m3u8-concat.sh
Created March 14, 2019 16:55 — forked from maxwellito/m3u8-concat.sh
Concat / join .ts segment files into an mp4 file
#!/bin/sh
# This script must be executed in the repo where
# the *.ts files are.
# It will concatenate the segments into one temp
# file which ffmpeg will reencode the audio track.
# By default the ouptup filename is output.mp4
# but can be changed by providing the name as parameter.
#
# ffmpeg is required
@flashfoxter
flashfoxter / selenium-download.py
Created March 19, 2019 19:40 — forked from blaix/selenium-download.py
Download file in a selenium session that requires a cookie from that session
# http://selenium-python.readthedocs.org/en/latest/api.html?highlight=cookie#selenium.webdriver.remote.webdriver.WebDriver.get_cookie
cookie = driver.get_cookie("cookie_name")
subprocess.check_call(["curl", "--cookie", "cookie_name=%" % cookie["value"], url, "-o", "destination_filename")
@flashfoxter
flashfoxter / mount_smbfs.sh
Created March 22, 2019 15:41 — forked from natritmeyer/mount_smbfs.sh
How to mount and unmount a SMB share on Mac OS X (using mount_smbfs)
#Mounting the share is a 2 stage process:
# 1. Create a directory that will be the mount point
# 2. Mount the share to that directory
#Create the mount point:
mkdir share_name
#Mount the share:
mount_smbfs //username:[email protected]/share_name share_name/
@flashfoxter
flashfoxter / async-python.py
Created April 12, 2019 21:06 — forked from pkazmierczak/async-python.py
asyncio example (python3 & python2)
import asyncio
@asyncio.coroutine
def factorial(name, number):
f = 1
for i in range(2, number + 1):
print("Task %s: Compute factorial(%d)..." % (name, i))
yield from asyncio.sleep(1)
f *= i
@flashfoxter
flashfoxter / embedded-file-viewer.md
Created January 17, 2020 07:19 — forked from tzmartin/embedded-file-viewer.md
Embedded File Viewer: Google Drive, OneDrive

Office Web Apps Viewer

('.ppt' '.pptx' '.doc', '.docx', '.xls', '.xlsx')

http://view.officeapps.live.com/op/view.aspx?src=[OFFICE_FILE_URL]

<iframe src='https://view.officeapps.live.com/op/embed.aspx?src=[OFFICE_FILE_URL]' width='px' height='px' frameborder='0'>
</iframe>

OneDrive Embed Links

@flashfoxter
flashfoxter / git-deployment.md
Created May 19, 2020 14:25 — forked from noelboss/git-deployment.md
Simple automated GIT Deployment using Hooks

Simple automated GIT Deployment using GIT Hooks

Here are the simple steps needed to create a deployment from your local GIT repository to a server based on this in-depth tutorial.

How it works

You are developing in a working-copy on your local machine, lets say on the master branch. Most of the time, people would push code to a remote server like github.com or gitlab.com and pull or export it to a production server. Or you use a service like deepl.io to act upon a Web-Hook that's triggered that service.

#install oracle java https://www.digitalocean.com/community/tutorials/how-to-install-java-on-ubuntu-with-apt-get
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer
#ANDROIDSTUDIO
#necessary for mksdcard
sudo apt-get install lib32stdc++6

How to install OpenSTF in Ubuntu 14.04

  1. Add Add RethinkDB key

     source /etc/lsb-release && echo "deb http://download.rethinkdb.com/apt $DISTRIB_CODENAME main" | sudo tee /etc/apt/sources.list.d/rethinkdb.list
     wget -qO- https://download.rethinkdb.com/apt/pubkey.gpg | sudo apt-key add -
    
  2. Install packages

sudo apt-get update && sudo apt-get install -y git nodejs nodejs-legacy npm rethinkdb android-tools-adb python autoconf automake libtool build-essential ninja-build libzmq3-dev libprotobuf-dev git graphicsmagick yasm stow

@flashfoxter
flashfoxter / post-receive
Created June 26, 2020 08:10 — forked from lemiorhan/post-receive
Post-receive hook to deploy the code being pushed to production branch to a specific folder
#!/bin/bash
target_branch="production"
working_tree="PATH_TO_DEPLOY"
while read oldrev newrev refname
do
branch=$(git rev-parse --symbolic --abbrev-ref $refname)
if [ -n "$branch" ] && [ "$target_branch" == "$branch" ]; then
@flashfoxter
flashfoxter / docker-git-post-receive.sh
Created October 15, 2020 10:18 — forked from Aukhan/docker-git-post-receive.sh
A sample git post-receive hook to deploy with docker. Use the latest commit hash as image tags to make sure the latest gets pulled always, assumes services were deployed using docker stack deploy.
#!/bin/bash
PREFIX="MY CLIENT -"
REPO_PATH='/home/ubuntu/server/client'
ACCEPTABLE_BRANCH="DEV"
COMPOSE_FILE="docker-compose.production.yml"
CLIENT_IMAGE="127.0.0.1:5000/mpc_nginx_client"