Skip to content

Instantly share code, notes, and snippets.

View equivalentideas's full-sized avatar
🍉
He/Him/His

Luke Bacon equivalentideas

🍉
He/Him/His
View GitHub Profile
@equivalentideas
equivalentideas / email_divider.sh
Created June 7, 2017 11:57
Bash script for dividing emails.txt into separate .csv files for each 2000 email addresses
line_count=$(cat emails.txt | wc -l)
file_count=0
while [ $file_count -lt $line_count ]
do
echo "creating file emails_$file_count.csv"
tail -n+$file_count emails.txt | head -n2000 >> emails_$file_count.csv
file_count=$[$file_count+2000]
done
@equivalentideas
equivalentideas / extract_hidden_requests_from_right_to_know.rb
Last active August 17, 2017 06:38
Script to run using rails runner to extract information about hidden information requests from Right To Know for analysis. It makes a .csv file with the days date in the title, containing some select (and not safe to publish) information on every hidden request.
CSV.open("./tmp/#{Date.today.to_s}_hidden_requests.csv", "wb") do |csv|
# Make headers
csv << [
"id",
"title",
"url",
"public_body_name",
"jurisdiction",
"created_at",
"requester_name",
@equivalentideas
equivalentideas / webscraping_workshop_links.md
Last active August 23, 2017 02:13
Introduction to Web Scraping Workshop
@equivalentideas
equivalentideas / Rebooting morph.io production Linode server.md
Last active October 2, 2017 10:28
Runsheet for rebooting the current production morph.io server

Rebooting the production morph.io server

  1. Log into Linode and go to the page for morph.io
  2. Go to the Remote Access tab and to Console Access at the bottom of that page
  3. There’s a command there called ‘Lish via SSH’
  4. Copy that to your local shell and run it. You should now see the output of the machine, processes running, dying etc.
  5. In another shell session ssh to root@morph.io
  6. Try the light touch first, run reboot there
    • If you switch to the lish session, you will see processes start shutting down in the linode console access session
  • after a minute that may become stuck on a command
@equivalentideas
equivalentideas / slack_reactions_from_export.rb
Created November 7, 2017 00:04
Extract a list of all the reactions to messages from a Slack data export
# Put this script in the root directory of a Slack data export
# Run `bundle install` and then `bundle exec ruby slack_reactions_from_export.rb`
# This will create a file called `reactions.txt` with rows like this:
#
# 2017-04-09 9:56 in #general: 😀
# 2017-04-10 9:45 in #tech-discussions: ⚽️
# 2017-04-19 15:45 in #general: 💖
# 2017-04-20 11:59 in #general: :hugging_face:
# 2017-04-20 22:35 in #general: 🤕
# 2017-04-30 21:38 in #most17: ❤️❤️
@equivalentideas
equivalentideas / 2018-02-05_working_with_spreadsheets_outline.md
Created February 7, 2018 08:32
Outline for Working with spreadsheets, Free Class at Frontyard Projects

2018-02-05 Working with spreadsheets, Free Class at Frontyard Projects

Session Outline

  • What is data?
    • Things and their attributes
    • How do spreadsheets present data? Rows and columns, things and attributes
    • Example, plants? Coconut tree, fig tree, parsley, strawberry, silver beat
    • Why use a spreadsheet to work with this data? Graphic and usable way to build and organise data
  • Quick and powerful analysis tool
@equivalentideas
equivalentideas / share-links-jekyll
Last active October 14, 2018 21:57
Social media share links for Jekyll/Liquid. Add these into a Jekyll layout to produce social media share links using that page's url and description.