Skip to content

Instantly share code, notes, and snippets.

View crossan007's full-sized avatar

Charles Crossan crossan007

View GitHub Profile
#WORKING
gst-launch-1.0 tcpclientsrc host=127.0.0.1 port=15000 ! queue ! matroskademux name=d ! videoconvert ! videorate ! videoscale ! video/x-raw,width=1280,height=720,framerate=30/1 ! x264enc bitrate=4000 key-int-max=2 speed-preset=veryfast ! video/x-h264,profile=baseline ! h264parse ! queue ! flvmux name=mux d. ! audioresample ! audio/x-raw,rate=44100 ! queue ! voaacenc bitrate=128000 ! queue ! mux. mux. ! rtmpsink location="rtmp://rtmp-api.facebook.com:80/rtmp/<KEY>"
@crossan007
crossan007 / Start-SQLBackup.ps1
Last active January 1, 2018 16:06
SQL Server PowerShell Backup
$ServerName = "SERVER"
$BackupDirectory = "D:\Backups\"
$BackupDate = get-date -format yyyyMMdd_HHmmss
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.SMO") | out-null
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.SmoExtended") | Out-Null
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.ConnectionInfo") | Out-Null
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.SmoEnum") | Out-Null
$ServerSMO = new-object ("Microsoft.SqlServer.Management.Smo.Server") $ServerName

ffmpeg

Say that you want to cut out a part starting at 00:00:30 into the original file with a 5 seconds length and that it shouldn't be re-encoded (if you want to re-encode it you'll have to replace copy with audio and video codecs, for a list of available codecs issue ffmpeg -formats -E), then you issue:

ffmpeg -ss 00:00:30 -i orginalfile -t 00:00:05 -vcodec copy -acodec copy newfile

You'll have to replace orginalfile and newfile with actual file names, the later is the name of the file that is created to hold the cut out part.

OR - to set partial second start and shorter end, while dropping video and recode audio to MP3:

@crossan007
crossan007 / 32to2.sh
Created December 22, 2017 03:18
Allen Heath QU32 GStreamer extract two channels
#!/bin/bash
/usr/share/voctomix-outcasts/ingest.py --custom-pipeline \
"videotestsrc pattern=2 ! queue ! videoconvert ! videorate ! videoscale ! \
video/x-raw,format=I420,width=1920,height=1080,framerate=30/1,pixel-aspect-ratio=1/1 ! \
queue ! mux. \
alsasrc name=audiosrc device=hw:CARD=QU32,DEV=0 provide-clock=false slave-method=re-timestamp ! \
audio/x-raw,channels=32,layout=interleaved,rate=48000 ! queue ! \
deinterleave name=d \
interleave name=i \
@crossan007
crossan007 / Set-GifSpeed.ps1
Created May 3, 2018 13:47
Set Animated Gif Speed PowerShell FFMpeg
Function Set-GifSpeed {
Param(
$inputFile,
$SpeedFactor
)
$Name = $(Split-Path $inputFile -Leaf)
$outPath = $(Split-Path $inputFile -Parent)+"\out"
New-Item -Path $outPath -ItemType Directory -ErrorAction SilentlyContinue | Out-Null
$outFile = """$outPath\$Name"""
@crossan007
crossan007 / Resize-VBOXDisk.ps1
Created May 31, 2018 19:44
VirtualBox Resize Disk on VM
$VMName = "MyCoolVM"
$NewDiskSize = 102400
$VBoxManage = 'C:\Program Files\Oracle\VirtualBox\VBoxManage.exe'
# Gather data from VBoxManage
$VBOXDrive = & $VBoxManage showvminfo $VMName | Select-String ".vmdk"
$RegEx = 'SATA \((\d),\s?(\d)\):\s?(.*?)\s\(UUID:(.*?)\)'
$M = [System.Text.RegularExpressions.Regex]::Matches($VBOXDrive,$RegEx)
$VMDK = $M.Groups[3].Value
@crossan007
crossan007 / keybase.md
Created June 27, 2018 15:43
keybase.md

Keybase proof

I hereby claim:

  • I am crossan007 on github.
  • I am crossan007 (https://keybase.io/crossan007) on keybase.
  • I have a public key ASBeYWUz3Uibu1jTf8gsXZzmm9rPqCUGaf2qhLnVh2cougo

To claim this, I am signing this object:

@crossan007
crossan007 / Convert-TopToBranch.ps1
Last active July 23, 2018 17:42
Convert All Top-Level Folders in Git Repository to Independent Repositories
# This basically creates a fork-bomb where each forked process is splitting out one top-level folder
$MaxSimultaneousJobs = $(Get-WmiObject –class Win32_processor).NumberOfCores * .5
Write-Host "Processing up to $MaxSimultaneousJobs at a time"
Get-ChildItem -Directory | Foreach-Object {
$FolderName = """$($_.Name)"""
$BranchName = $_.Name -Replace(' ','-')
while (@(Get-Job -State Running).Count -ge $MaxSimultaneousJobs) {
/* Add Recurring event, with a secondary calendar on the Third Tuesday of the Month */
DELIMITER $$
DROP PROCEDURE IF EXISTS create_events$$
CREATE PROCEDURE create_events()
BEGIN
DECLARE event_date DATETIME;
DECLARE event_end DATETIME;
DECLARE ocurrences INT;
DECLARE last_inserted INT;
DECLARE week_of_month DOUBLE;