Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
Working on changing the world.

Anthony Eden anthonyeden

💭
Working on changing the world.
View GitHub Profile
@anthonyeden
anthonyeden / RDS_INSTALL.bat
Created Oct 28, 2017
Let's Encrypt & Microsoft Remote Desktop Services - Installation Script
View RDS_INSTALL.bat
"C:\Program Files\Lets Encrypt\letsencrypt.exe" --renew --baseuri "https://acme-v01.api.letsencrypt.org/"
powershell -File "C:\Program Files\Lets Encrypt\RDS_INSTALL_CERT.ps1" -CertificateImport "C:\ProgramData\letsencrypt-win-simple\httpsacme-v01.api.letsencrypt.org\remote.example.com-all.pfx" -RDCB remote.example.com
@anthonyeden
anthonyeden / AWS_S3_Presign_Download.php
Last active Dec 23, 2020
AWS S3: Pre-sign Upload & Download Requests [PHP]
View AWS_S3_Presign_Download.php
<?php
function AWS_S3_PresignDownload($AWSAccessKeyId, $AWSSecretAccessKey, $BucketName, $AWSRegion, $canonical_uri, $expires = 8400) {
// Creates a signed download link for an AWS S3 file
// Based on https://gist.github.com/kelvinmo/d78be66c4f36415a6b80
$encoded_uri = str_replace('%2F', '/', rawurlencode($canonical_uri));
// Specify the hostname for the S3 endpoint
if($AWSRegion == 'us-east-1') {
@anthonyeden
anthonyeden / command-dshow-listinputs.txt
Last active Dec 14, 2020
FFmpeg - Streaming to Icecast from Line In (192Khz FLAC)
View command-dshow-listinputs.txt
ffmpeg -list_devices true -f dshow -i dummy
@anthonyeden
anthonyeden / Responsive-YouTube-Embed-Wordpress-Filters.php
Last active Dec 1, 2020
Responsive YouTube Embeds in Wordpress
View Responsive-YouTube-Embed-Wordpress-Filters.php
<?php
add_filter('the_content', function($content) {
return str_replace(array("<iframe", "</iframe>"), array('<div class="iframe-container"><iframe', "</iframe></div>"), $content);
});
add_filter('embed_oembed_html', function ($html, $url, $attr, $post_id) {
if(strpos($html, 'youtube.com') !== false || strpos($html, 'youtu.be') !== false){
return '<div class="embed-responsive embed-responsive-16by9">' . $html . '</div>';
} else {
View icecast_config_sample.xml
<mount>
<mount-name>/mountname</mount-name>
<password>hackme</password>
<!-- Geo-blocking can be added to any mount, but not relays -->
<authentication type="url">
<option name="listener_add" value="http://example.com/icecast_geoblock.php?mount=mountmame" />
<option name="auth_header" value="icecast-auth-user: 1" />
</authentication>
</mount>
@anthonyeden
anthonyeden / FontInstallation.ps1
Last active Nov 15, 2020
Font User Installation - Powershell (No Admin Password Needed)
View FontInstallation.ps1
# Run this as a Computer Startup script to allow installing fonts from C:\InstallFont\
# Based on http://www.edugeek.net/forums/windows-7/123187-installation-fonts-without-admin-rights-2.html
# Run this as a Computer Startup Script in Group Policy
# Full details on my website - https://mediarealm.com.au/articles/windows-font-install-no-password-powershell/
$SourceDir = "C:\InstallFont\"
$Source = "C:\InstallFont\*"
$Destination = (New-Object -ComObject Shell.Application).Namespace(0x14)
$TempFolder = "C:\Windows\Temp\Fonts"
@anthonyeden
anthonyeden / paradox.py
Last active Nov 5, 2020 — forked from BertrandBordage/paradox.py
Python Paradox database reader
View paradox.py
# coding: utf-8
"""
Converts Paradox databases to Python objects or CSV.
You don't need any dependency (except Python) to make this module work.
This module is incomplete but reads most Paradox `.DB` files.
If this module is not fast or complete enough for you, consider using pxview.
CAUTION: THIS SOFTWARE DOES NOT RELIABLY FETCH ALL DATA FROM PARADOX. CONSIDER USING ODBC DRIVERS INSTEAD.
@anthonyeden
anthonyeden / countdown_5mins.txt
Created Jul 21, 2019
Adobe After Effects - Countdown Expressions
View countdown_5mins.txt
st = 300;
t = st - time;
c = timeToTimecode(t);
c = c.substring(4,8)
c
@anthonyeden
anthonyeden / simplistic-ffmpeg-streaming.py
Created May 28, 2018
Sending FFmpeg output to HTTP, via Python's Flash
View simplistic-ffmpeg-streaming.py
"""
Streaming FFmpeg to HTTP, via Python's Flask.
This is an incredibly simple example, which will yield issues due to inconsistant input and output rates.
If you're going to use this, VLC works okay as a client.
You really need to move FFmpeg into a separate thread, which should help stream audio more consistantly to the HTTP client.
Example by Anthony Eden (https://mediarealm.com.au)
"""
from flask import Flask
@anthonyeden
anthonyeden / wordpress-date.php
Last active Sep 10, 2020
Wordpress Date() and StrToTime() Functions
View wordpress-date.php
<?php
function wp_date_localised($format, $timestamp = null) {
// This function behaves a bit like PHP's Date() function, but taking into account the Wordpress site's timezone
// CAUTION: It will throw an exception when it receives invalid input - please catch it accordingly
// From https://mediarealm.com.au/
$tz_string = get_option('timezone_string');
$tz_offset = get_option('gmt_offset', 0);