Skip to content

Instantly share code, notes, and snippets.

Avatar
👹
Ducking and diving

Daniel Pett portableant

👹
Ducking and diving
View GitHub Profile
View splitAudio.py
#!/usr/bin/python
## Split audio files into chunks
## Daniel Pett 1/5/2020
__author__ = 'portableant'
## Tested on Python 2.7.16 - yes I know I need to upgrade.
import argparse
import os
import speech_recognition as sr
View splitAudio.py
#!/usr/bin/python
## Split audio files into chunks
## Daniel Pett 1/5/2020
__author__ = 'portableant'
## Tested on Python 2.7.13
import argparse
import os
import speech_recognition as sr
View gist:797812d094b4ca559b4b78e918d03a78
import speech_recognition as sr
filename = "2101.wav"
r = sr.Recognizer()
with sr.AudioFile(filename) as source:
# listen for the data (load audio to memory)
audio_data = r.record(source)
# recognize (convert from speech to text)
text = r.recognize_google(audio_data)
print(text)
@portableant
portableant / scrapetosolr.py
Last active May 1, 2020
Scrape a page to solr instance example
View scrapetosolr.py
import sys
from bs4 import BeautifulSoup
import solr
import hashlib
import urllib.request
import xml.etree.ElementTree as ET
limit = 0 # How many iterations max? Enter 0 for no limit.
solrUrl = 'solrURL' # The URL of the solr instance
sitemaps_ns = 'http://www.sitemaps.org/schemas/sitemap/0.9' # The xmlns for the sitemap schema
View workshop.geojson
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@portableant
portableant / replacer.py
Created Jan 6, 2020 — forked from meddulla/replacer.py
Script to recursively replace string in filename and contents
View replacer.py
"""
Usage: python script.py search_string replace_string dir
Eg. python batchreplace.py galleries productions /Sites/cjc/application/modules/productions/
And it will search recursively in dir
and replace search_string in contents
and in filenames.
Case-sensitive
"""
from sys import argv
View a5a6.geojson
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View testcyprus.json
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View gist:9a7c5f0966cf1c33b91a083e8aae55a2
git clone https://github.com/open360labs/timeoff-management.git
cd timeoff-management
npm install https://github.com/mapbox/node-sqlite3/tarball/master
npm install
npm start
@portableant
portableant / sfab.txt
Created Aug 5, 2019
ADAPL for sketchfab
View sfab.txt
* Before screen ADAPL for web links
integer occ, linkocc, urlok
text testurl[0]
x1 = null
linkocc = 1
urlok = 0
testurl = ''