Skip to content

Instantly share code, notes, and snippets.

@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'
@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

@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
@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