This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask, request, jsonify, Response | |
from faster_whisper import WhisperModel | |
import subprocess | |
app = Flask(__name__) | |
# Initialize the faster-whisper model | |
model = WhisperModel("small", device="cuda") # Use 'cuda' to leverage the GPU | |
@app.route('/transcribe', methods=['POST']) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Dockerfile for a simple PoC faster-whisper translation server in GCP GPU Cloud Run | |
# 20240925 rickt | |
# | |
# build: $ docker build -t gcr.io/<gcp_project_name>/<service_name> . | |
# push: $ docker push gcr.io/<gcp_project_name>/<service_name> | |
# deploy: $ gcloud beta run deploy <service_name> --region us-central1 --image gcr.io/<gcp_project_name>/<service_name> \ | |
# --port 8080 --cpu 8 --memory 32Gi --gpu 1 --gpu-type nvidia-l4 --max-instances 1 --allow-unauthenticated | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
# | |
# rough and ready bash script to download & decrypt a widevine-encrypted video via MPD URL | |
# this will work with (for example) channel5 UKTV | |
# | |
# assumptions: | |
# 1) the following binaries are in your $PATH: | |
# curl, ffmpeg, head, jq, mp4decrypt, yt-dlp | |
# | |
# this script requires 2x arguments: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
# set required date range using epoch. sample data used below | |
RANGE=`seq 1642701000 50 1642710633` | |
# ensure tmp folder exists | |
TEMPDIR=/tmp/fogpics_$$ | |
[ ! -d "$TEMPDIR" ] && mkdir -p $TEMPDIR | |
# download the pics |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"github.com/dustin/go-humanize" | |
"golang.org/x/oauth2" | |
"golang.org/x/oauth2/google" | |
"google.golang.org/api/drive/v3" | |
"io/ioutil" | |
"log" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
from google.cloud import bigquery | |
def csv_loader(data, context): | |
client = bigquery.Client() | |
dataset_id = os.environ['DATASET'] | |
dataset_ref = client.dataset(dataset_id) | |
job_config = bigquery.LoadJobConfig() | |
job_config.schema = [ | |
bigquery.SchemaField('id', 'INTEGER'), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
// https://rickt.org/2019/01/08/playing-with-g-suite-mdm-mobile-device-data-using-go/ | |
import ( | |
"context" | |
"errors" | |
"flag" | |
"fmt" | |
"github.com/dustin/go-humanize" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Example fluentd config file for nginx access log injection into Google Bigquery | |
# collecting nginx access log | |
<source> | |
@type tail | |
tag accesslogs-rickts-dev-box | |
path /var/log/nginx/access.log | |
format apache | |
buffer_type file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package slackweatherbot | |
import ( | |
owm "github.com/briandowns/openweathermap" | |
"golang.org/x/net/context" | |
"google.golang.org/appengine" | |
"google.golang.org/appengine/log" | |
"google.golang.org/appengine/urlfetch" | |
"net/http" | |
"os" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"encoding/json" | |
"fmt" | |
"log" | |
"net/http" | |
"strings" | |
"time" | |
) |
NewerOlder