Skip to content

Instantly share code, notes, and snippets.

View macleginn's full-sized avatar

Dmitry Nikolayev macleginn

View GitHub Profile
@macleginn
macleginn / measureAndPlotFormants.praat
Last active July 16, 2016 10:31
Praat editor script for plotting formants from the selected segment and printing their values along with the duration in the info window
Extract selected sound (time from 0)
endeditor
duration = Get total duration
writeInfoLine: fixed$ (duration, 3)
# Replace 5000 with 5500 for female voice.
# You may need to tweak the number of formants (2nd parameter) based on
# your data. Sometimes, if two formants are close to each other,
# it is necessary to ask for 6 formants so that they may be decoupled.
# In other cases, however, this may introduce spurious formants, and
# it is always advisable to check the spectrogram.
@macleginn
macleginn / collate_emails.js
Created July 3, 2016 19:05
Put all the messages from a Gmail inbox satisfying a query into a Google document
function collateMessages() {
var searchString = "YOURQUERYHERE";
// A query can be anything that you can enter
// into the Gmail search field:
// "datageddon from:[email protected] filename:pdf"
// etc.
var doc = DocumentApp.create(searchString);
var threads = GmailApp.search(searchString);
for (var j = 0; j < threads.length; j++) {
var messages = threads[j].getMessages();
@macleginn
macleginn / mysql2csv.py
Last active June 14, 2022 10:38
Export all tables from a MySQL database as .csv files using Python 3
import pymysql
def execute(c, command):
c.execute(command)
return c.fetchall()
db = pymysql.connect(host='localhost', port=3306, user='root', passwd='', db='mysql') #, charset='utf8')
c = db.cursor()

Keybase proof

I hereby claim:

  • I am macleginn on github.
  • I am macleginn (https://keybase.io/macleginn) on keybase.
  • I have a public key whose fingerprint is 5977 6205 D291 C872 046E BEE8 DCE0 A9D6 0E0B 6194

To claim this, I am signing this object: