Skip to content

Instantly share code, notes, and snippets.

View tylercubell's full-sized avatar

Tyler tylercubell

View GitHub Profile
@tylercubell
tylercubell / dynamic_switching.py
Created February 4, 2019 19:02
GStreamer Python Dynamic Switching
import gi
gi.require_version('Gst', '1.0')
from gi.repository import GObject, Gst
from threading import Thread, Event
GObject.threads_init()
Gst.init(None)
class Main:
def __init__(self):
import os, subprocess
# Remove null characters.
# http://gnuwin32.sourceforge.net/packages/coreutils.htm
file = "your_file_here"
command = ["C:\\Program Files (x86)\\GnuWin32\\bin\\tr.exe",
"-d \'\\000\'"]
with open(file, "r") as original, open(file + ".new", "w", encoding="utf-8") as modified:
import os, subprocess
# Convert from ANSI (Windows-1251) to UTF-8 using iconv.
# http://gnuwin32.sourceforge.net/packages/libiconv.htm
file = "your_file_here"
command = ["C:\\Program Files (x86)\\GnuWin32\\bin\\iconv.exe",
"-f cp1251", # Could also be cp1252 or other encoding types.
"-t utf-8",
'"' + file + '"']
SELECT b1.bID as id,
u.uID as post_author,
b1.bDateAdded as post_date,
CONVERT_TZ(b1.bDateAdded,'-05:00','+00:00') as post_date_gmt,
b2.content as post_content,
c2.cvName as post_title,
c2.cvDescription as post_excerpt,
IF(b1.bIsActive = 1,'publish','draft') as post_status,
'open' as comment_status,
'open' as ping_status,
#!/bin/bash
# Backup MySQL database using dotenv file
#
# Example:
# ./backup_database.sh /path_to_project/.env
#
# Result:
# Schema-only and data-only .sql files