Skip to content

Instantly share code, notes, and snippets.

View thejasonfisher's full-sized avatar

Jason Fisher thejasonfisher

View GitHub Profile
@thejasonfisher
thejasonfisher / cluster-db-smartcopy.sh
Last active January 3, 2016 04:49
cluster-db-smartcopy.sh sourcehost sourcedb desthost destdb password
#!/bin/bash
#Source
USER=root
PASS=$5
PORT=3306
HOST1=$1
HOST2=$1
#Dest
<?php
/**
* Implements hook_menu().
*/
function mymodule_menu() {
$items['mymodule/%ctools_js/add'] = array(
'page callback' => 'mymodule_node_add_modal_callback',
'page arguments' => array(1),
'access arguments' => array('access content'),
<?php
function example_form_element_label($variables) {
$element = $variables['element'];
// This is also used in the installer, pre-database setup.
$t = get_t();
// If title and required marker are both empty, output no label.
if ((!isset($element['#title']) || $element['#title'] === '') && empty($element['#required'])) {
return '';
}
@thejasonfisher
thejasonfisher / scan.py
Created June 24, 2021 06:57 — forked from pgolding/scan.py
scan all elements from a dynamodb table using Python (boto3)
from __future__ import print_function # Python 2/3 compatibility
import boto3
import json
import decimal
from boto3.dynamodb.conditions import Key, Attr
# Helper class to convert a DynamoDB item to JSON.
class DecimalEncoder(json.JSONEncoder):
def default(self, o):
if isinstance(o, decimal.Decimal):
@thejasonfisher
thejasonfisher / README.md
Created July 21, 2021 01:32 — forked from plindberg/README.md
How to set up an AWS Lambda function for returning S3 pre-signed URLs for uploading files.

README

Granted, this is little more than an obfuscated way of having a publicly writable S3 bucket, but if you don’t have a server which can pre-sign URLs for you, this might be an acceptable solution.

For this to work, you take the following steps:

  1. Create a Lambda func, along with a new IAM role, keeping the default code.
  2. Create an API in the API Gateway.
@thejasonfisher
thejasonfisher / hdhr-listings-to-m3u.py
Created March 14, 2022 21:35 — forked from aaearon/hdhr-listings-to-m3u.py
Convert HDHomeRun Prime Listings to M3U Format
#
# this script will convert the hdhomerun listings (channels) to
# m3u format for use with external media players. before running
# this script, be sure to modify the <<config>> variable settings
# below.
#
# Suggested Usage: This script should be run on a cron to keep
# the channel lineup to date. Below is an example of how to execute this script:
# python /path/to/script/hdhomerun-prime-listings-to-m3u.py > /path/to/playlist.m3u
#
@thejasonfisher
thejasonfisher / .zshrc
Created May 18, 2022 03:13 — forked from dimitardanailov/.zshrc
My personal zsh and tmux configurations
# Path to your oh-my-zsh installation.
export ZSH=/Users/dimitar.danailov/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
# ZSH_THEME="robbyrussell"
ZSH_THEME="agnoster"
@thejasonfisher
thejasonfisher / pytorch-glumpy.py
Created February 26, 2023 03:31 — forked from victor-shepardson/pytorch-glumpy.py
using pycuda and glumpy to draw pytorch GPU tensors to the screen without copying to host memory
from contextlib import contextmanager
import numpy as np
import torch
from torch import Tensor, ByteTensor
import torch.nn.functional as F
from torch.autograd import Variable
import pycuda.driver
from pycuda.gl import graphics_map_flags
from glumpy import app, gloo, gl

ffmpeg 4.4 with NDI

This patch adds libndi_newtek to last ffmpeg version, and fix timecode related issues that produces wrong PTS/DTS timestamps that seems to happen with newer NDI SDKs.

changes

  • Updated libndi methods by newer versions (v2/v3)
  • Calculating PTS/DTS from timestamp instead of timecode, that is optionally sent by the sender.