Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python3
import os
import sys
walk_dir = os.getcwd()
count = 0
def from_ts_to_mp4(source_file, dest_file):
os.system("ffmpeg -i {} -c:v copy -c:a copy {}".format(source_file, dest_file))

ffmpg recipes

Convert from ts to mp4

ffmpeg -i input.ts -c copy output.mp4

Concatenate

ffmpeg -i 'concat:input-1.ts|input-2.ts|input-3.ts' -codec copy output.ts

Split

ffmpeg -i <input> -vcodec copy -acodec copy -ss <from_time> -t <to_time> -sn <output>

<?xml version="1.0" encoding="UTF-8"?>
<listings>
<title>My Hotel Feed</title>
<listing>
<hotel_id>1234</hotel_id>
<name>The best hotel</name>
<description>A very nice hotel</description>
<brand>Premium_brand</brand>
<address format="simple">
<component name="addr1">100 Main Street</component>
<?xml version="1.0"?>
<rss version="2.0" xmlns:g="http://base.google.com/ns/1.0">
<channel>
<title>The Title</title>
<link>http://www.example.com</link>
<description>An example item from the feed</description>
<item>
<g:id>DB_1</g:id>
<g:availability>in stock</g:availability>
<g:condition>new</g:condition>
@gardenunez
gardenunez / delete_branches.sh
Created July 17, 2017 09:08
delete-branches-but-master
git branch | grep -v master | xargs git branch -D
@gardenunez
gardenunez / git-aliases.sh
Created January 27, 2017 09:52
git aliases
git config --global alias.co checkout
git config --global alias.br branch
git config --global alias.ci commit
git config --global alias.st status
git config --global alias.unstage 'reset HEAD --'
git config --global alias.last 'log -1 HEAD'
@gardenunez
gardenunez / github-clone-org.sh
Created October 28, 2016 22:15
clone github organization repositories
curl -u $1:$2 -s "https://api.github.com/orgs/$3/repos?per_page=200" | ruby -rubygems -e 'require "json"; JSON.load(STDIN.read).each { |repo| %x[git clone #{repo["ssh_url"]} ]}'
#!/bin/bash
# store the current dir
CUR_DIR=$(pwd)
# Let the person running the script know what's going on.
echo "\n\033[1mPulling in latest changes for all repositories...\033[0m\n"
# Find all git repositories and update it to the master latest revision
for i in $(find . -name ".git" | cut -c 3-); do
@gardenunez
gardenunez / git-author-rewrite
Created July 12, 2016 15:23
rewrite author name and email in git repo
#!/bin/sh
git filter-branch --env-filter '
OLD_EMAIL="your-old-email@example.com"
CORRECT_NAME="Your Correct Name"
CORRECT_EMAIL="your-correct-email@example.com"
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
export GIT_COMMITTER_NAME="$CORRECT_NAME"
export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL"
import urllib2
import time
import xml.etree.ElementTree as ET
from datetime import datetime
OAI = "{http://www.openarchives.org/OAI/2.0/}"
ARXIV = "{http://arxiv.org/OAI/arXiv/}"
def harvest(initial_date, end_date):
results = []