Skip to content

Instantly share code, notes, and snippets.

View ralphievolt's full-sized avatar

ralph emerson ralphievolt

View GitHub Profile
@ralphievolt
ralphievolt / ExtractSpecificTextFromEmail.txt
Created May 10, 2020 08:31 — forked from moayadhani/ExtractSpecificTextFromEmail.txt
Extract Email Text from Google Sheet using App Script
//Sample email that is received and whose details are extracted:
/*
*Someone* just submitted your form named Online Course Booking from your
website
https://www.abcd.com/
Message Details
Full Name: Mohamed Ali
Email Address: abcd123@gmail.com
Phone Number: 009725991122334
@ralphievolt
ralphievolt / mostPostedTracks.js
Created November 5, 2018 04:35 — forked from adrienjoly/mostPostedTracks.js
mongodb "group by" query using aggregation for counting documents per category, on a objectid-timestamp-based subset
db = db.getSiblingDB("whyd_music") // explicitely select collection
var jan2014 = ObjectId("52c35a800000000000000000"); // created using http://steveridout.github.io/mongo-object-time/
db.post.aggregate([
{"$sort": {"_id": -1}}, // order: antichronological
{"$match": {"_id": {"$gt": jan2014}}}, // only documents that were created after the 1syt january 2014
{"$group": {"_id": "$eId", // group by value of the eId attribute -> _id attribute in the resulting output collection
"name": {"$first": "$name"}, // -> include the name of each grouped category
"count": {"$sum": 1}}}, // -> count attribute will contain the number of documents for each value of _eid
{"$match": {"count": {"$gt": 50}}}, // limit output to results with count > 50
{"$sort": {"count": -1}} // output order: highest count first
@ralphievolt
ralphievolt / mysql-docker.sh
Created April 27, 2017 00:39 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE