Skip to content

Instantly share code, notes, and snippets.

@dannguyen
dannguyen / cardib-politics-talk-transcribe.md
Last active October 26, 2022 15:40
An example of how to use command-line tools to transcribe a viral video of Cardi B

Transcribing Cardi B's political speech with AWS Transcribe and command-line tools

Inspired by the following exchange on Twitter, in which someone captures and posts a valuable video onto Twitter, but doesn't have the resources to easily transcribe it for the hearing-impaired, I thought it'd be fun to try out Amazon's AWS Transcribe service to help with this problem, and to see if I could do it all from the bash command-line like a Unix dork.

Screencap of @jordanuhl's video tweet, followed by a request for a transcript

The instructions and code below show how to use command-line tools/scripting and Amazon's Transcribe service to transcribe the audio from online video. tl;dr: AWS Transcribe is a pretty amaz

@om-henners
om-henners / serializer_utils.py
Created November 19, 2018 13:51
Marshmallow serializers for turning fields into GeoJSON objects based on flask-sqlalchemy and geoalchemy2
"""
Marshmallow wrappers to produce GeoJSON instead of a flat dictionary.
"""
from flask_marshmallow import Marshmallow
import geoalchemy2
from geoalchemy2.shape import from_shape, to_shape
from marshmallow import fields, pre_load, post_dump, ValidationError
import marshmallow_sqlalchemy as msqla
from shapely import geometry
@andris9
andris9 / USAGE.md
Created September 1, 2016 08:43
Replace domain name in Wordpress database dump

wp-domain-change

Simple script to replace domain name in a Wordpress MySQL dump file. In addition to replacing domain names in standard string values, the script is able to correctly replace strings in serialized PHP values. This means that it should be safe to operate on data from wp_options table where plugins store data as serialized PHP

Usage

Run the script from command line. First argument is the domain name to replace and the second is the replacement. SQL dump is read from stdin and written to stdout

node wp-domain-change.js "http://source.domain" "http://dest.domain" < input.sql > output.sql

@ifokeev
ifokeev / smartupdate.sh
Created July 22, 2016 17:58
updating ubuntu repos and gpg
#!/bin/bash
# Эта пара строк не претендует на что-либо, но давно хотел это написать, а тут как раз и повод подвалил. :)
# Короче, это маленький скриптик для убунтоводов, автоматический запрашивающий GPG-ключи с keyserver.ubuntu.com для всех неподпписанных репозиториев. Будет полезен после добавления каждого нового PPA, чтобы не заниматься каждый раз копипастой фингерпринта и ручным вводом команды apt-key со всеми параметрами. Кроме того, наверное, будет полезен после переноса старого sources.list в свежеустановленную систему, когда внезапно оказывается, что репозитории-то перенесены, а ключи — нет.
# Запускать вместо apt-get update.
# Специально для http://welinux.ru/post/5160/
# Делаем разделитель строк, а не слов
OLDIFS=$IFS
IFS=$'\n'
@NickCraver
NickCraver / Windows10-Setup.ps1
Last active July 5, 2024 17:09
(In Progress) PowerShell Script I use to customize my machines in the same way for privacy, search, UI, etc.
##################
# Privacy Settings
##################
# Privacy: Let apps use my advertising ID: Disable
Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo -Name Enabled -Type DWord -Value 0
# To Restore:
#Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo -Name Enabled -Type DWord -Value 1
# Privacy: SmartScreen Filter for Store Apps: Disable
Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\AppHost -Name EnableWebContentEvaluation -Type DWord -Value 0
@ejdyksen
ejdyksen / patch-edid.md
Last active June 19, 2024 03:35
A script to fix EDID problems on external monitors in macOS

patch-edid.rb

A script to fix EDID problems on external monitors in macOS.

Instructions

  1. Connect only the problem display.

  2. Create this directory structure (if it doesn't already exist):

@Fabryz
Fabryz / server.js
Created September 22, 2012 20:50
Phantomjs - render html files contained in dir to png
var page = require('webpage').create(), loadInProgress = false, fs = require('fs');
var htmlFiles = new Array();
console.log(fs.workingDirectory);
var curdir = fs.list(fs.workingDirectory);
// loop through files and folders
for(var i = 0; i< curdir.length; i++)
{
var fullpath = fs.workingDirectory + fs.separator + curdir[i];
// check if item is a file
@mmohiudd
mmohiudd / wp_url_updater.php
Created May 15, 2012 18:16
WordPress URL update script
<?php
/*
Copyright (c) 2011 Muntasir Mohiuddin<muntasir@bakedproject.com>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN C
@gre
gre / easing.js
Last active June 27, 2024 15:37
Simple Easing Functions in Javascript - see https://github.com/gre/bezier-easing
/*
* This work is free. You can redistribute it and/or modify it under the
* terms of the Do What The Fuck You Want To Public License, Version 2,
* as published by Sam Hocevar. See the COPYING file for more details.
*/
/*
* Easing Functions - inspired from http://gizma.com/easing/
* only considering the t value for the range [0, 1] => [0, 1]
*/
EasingFunctions = {
@clee704
clee704 / rename-field.py
Created December 31, 2011 17:05
Rename Drupal 7 fields
#! /usr/bin/env python
from datetime import datetime
from StringIO import StringIO
import getpass, os, re, subprocess, sys
import MySQLdb
def main():
if len(sys.argv) != 3: