Skip to content

Instantly share code, notes, and snippets.

@ThomasSevestre
ThomasSevestre / sqlite-distance.rb
Created February 3, 2021 16:33 — forked from robmiller/sqlite-distance.rb
Ruby/SQLite code for finding places within a certain distance from another place. In other words, Ruby code that adds a "DISTANCE(lat1, lon1, lat2, lon2)" to SQLite, allowing you to select records based on the distance between two points of latitude and longitude. Magic! Adapted from the ObjectiveC version here: http://daveaddey.com/?p=71
db = SQLite3::Database.new ":memory:"
# A sample SQLite table; all that's necessary is the lat and log fields
db.execute <<-SQL
CREATE TABLE users (
email VARCHAR(255),
lat FLOAT,
lon FLOAT
)
SQL
@ThomasSevestre
ThomasSevestre / ffmpeg.md
Created October 26, 2020 13:43 — forked from protrolium/ffmpeg.md
ffmpeg guide

ffmpeg

Converting Audio into Different Formats / Sample Rates

Minimal example: transcode from MP3 to WMA:
ffmpeg -i input.mp3 output.wma

You can get the list of supported formats with:
ffmpeg -formats

Convert WAV to MP3, mix down to mono (use 1 audio channel), set bit rate to 64 kbps and sample rate to 22050 Hz:

@ThomasSevestre
ThomasSevestre / pcap2wav
Created November 29, 2017 13:00 — forked from avimar/pcap2wav
Convert raw PCAP files into a .wav file
#!/bin/bash
#
# pcap2wav
# Original Author: Michael Collins <[email protected]>
#Standard disclaimer: batteries not included, your mileage may vary...
# Updated by Avi Marcus <[email protected]>
#
# Accepts arg of pcap file w/only 2 RTP streams
# Creates a .<codec> file and a .wav file
# For codecs other than PCMA and PCMU the script calls fs_cli and does a little recording to create the wav file(s)
@ThomasSevestre
ThomasSevestre / kamailio.cfg
Created October 31, 2016 17:00 — forked from iwanbk/kamailio.cfg
kamailio.cfg with SIP over websocket. Modified from kamailio 4.0.1 example
#!KAMAILIO
#
# Simple/sample kamailio.cfg for running a proxy/registrar with TLS and
# WebSockets support.
###!substdef "!DBURL!sqlite:///etc/kamailio/db.sqlite!g"
#!substdef "!DBURL!mysql://kamailio:kamailiorw@localhost/kamailio!g"
#!substdef "!MY_IP_ADDR!10.0.11.175!g"
#!substdef "!MY_DOMAIN!ubukam.lan!g"
#!substdef "!MY_WS_PORT!5065!g"