Skip to content

Instantly share code, notes, and snippets.

View portableant's full-sized avatar
👹

Daniel Pett portableant

👹
View GitHub Profile
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 12:11
Scrape a page to solr instance example
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
Loading
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 January 6, 2020 12:59 — forked from meddulla/replacer.py
Script to recursively replace string in filename and contents
"""
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 August 5, 2019 11:36
ADAPL for sketchfab
* Before screen ADAPL for web links
integer occ, linkocc, urlok
text testurl[0]
x1 = null
linkocc = 1
urlok = 0
testurl = ''
@portableant
portableant / unattend.txt
Created May 16, 2019 22:05
Unattended Ubuntu upgrade set up
sudo su -
apt install unattended-upgrades
nano /etc/apt/apt.conf.d/50unattended-upgrades
Uncomment or change to the below:
"${distro_id}:${distro_codename}-updates";
Unattended-Upgrade::Mail "[email protected]";
Unattended-Upgrade::MailOnlyOnError "true";
Unattended-Upgrade::Remove-Unused-Kernel-Packages "true";
@portableant
portableant / example.md
Created March 13, 2019 13:34
Example file for embed of vimeo for Melanie
title author layout permalink
A test
Melanie
news
/news/test
<iframe src="https://player.vimeo.com/video/323323527 " width="640" height="1138" frameborder="0" \ webkitallowfullscreen mozallowfullscreen allowfullscreen>