Skip to content

Instantly share code, notes, and snippets.

View anthonycrumley's full-sized avatar

Anthony Crumley anthonycrumley

View GitHub Profile
@anthonycrumley
anthonycrumley / settings.json
Created August 18, 2023 23:57
VS Code Settings
{
"python.condaPath": "C:\\Users\\antho\\anaconda3\\Scripts\\conda-script.py",
"python.defaultInterpreterPath": "C:\\Users\\antho\\anaconda3\\python.exe",
"python.pythonPath": "C:\\Users\\antho\\anaconda3\\python.exe",
"python.terminal.activateEnvironment": true,
"terminal.integrated.defaultLocation": "editor",
"python.linting.flake8Enabled": true,
"vim.normalModeKeyBindings": [
// Open the settings JSON file.
{
@anthonycrumley
anthonycrumley / survey_monkey.rb
Created July 20, 2018 12:52
SurveyMonkey and ruby_http_client
require 'ruby_http_client'
class Http < SendGrid::Client
end
bearer_token = 'my token'
survey_monkey = Http.new(host: 'https://api.surveymonkey.com/v3', request_headers: {'Authorization' => "Bearer #{bearer_token}", "Content-Type" => "application/json"})
survey_monkey.users.me.get.parsed_body
@anthonycrumley
anthonycrumley / Script2HerokuDB
Created December 1, 2016 01:41
This runs a local script but connects to the heroku database.
DATABASE_URL=$(heroku config:get DATABASE_URL -a ednetwork) SECRET_KEY_BASE=$(heroku config:get SECRET_KEY_BASE -a ednetwork) LANG=$(heroku config:get LANG -a ednetwork) DISABLE_SPRING=1 RAILS_ENV=production RACK_ENV=production rails runner "puts School.first.inspect"
@anthonycrumley
anthonycrumley / RunHerokuScript.sh
Created November 16, 2016 17:31
A command for running a script with credentials from Heroku
DATABASE_URL=$(heroku config:get DATABASE_URL -a ednetwork) MONGOHQ_URL=$(heroku config:get MONGOHQ_URL -a ednetwork) irb scripts/migrate_members.rb
$(document).on 'ready page:load', ->
$('.select2').on 'select2:select', (e) ->
console.log(e.params.data.email)
require('mongo')
def client
@client ||= Mongo::Client.new([ '127.0.0.1:27017' ], :database => 'network-dev')
end
def participants
client[:participants]
end
@anthonycrumley
anthonycrumley / action_location.rb
Created January 18, 2016 20:25
Add location to actions based on the network event.
require('mongo')
def client
@client ||= Mongo::Client.new([ '127.0.0.1:27017' ], :database => 'network-dev')
end
def actions
client[:actions]
end
######################################################################
# Task: Describe a two-tape Turing machine that decides the
# language {x#y | x is a substring of y and x,y in {0,1}^* }
######################################################################
# Enter values below for
# q_0 : the initial state (an int)
# q_a : the accept state (an int)
# q_r : the reject state (an int)
# delta : the transition function expressed as a dictionary
# with keys (state, symbol, symbol) and
######################################################################
# Describe a Turing Machine that decides the language
# {w | w has an equal number of 0s and 1}
######################################################################
# Enter values below for
# q_0 : the initial state (an int)
# q_a : the accept state (an int)
# q_r : the reject state (an int)
# delta : the transition function expressed as a dictionary
# with keys (state, symbol) and values (state, symbol, 'L' or 'R')
######################################################################
# Task: Describe a Turing machine that shifts the input string one
# space to the right and places the symbol ($) in the first location
# on the tape.
######################################################################
# Enter values below for
# q_0 : the initial state (an int)
# q_a : the accept state (an int)
# q_r : the reject state (an int)
# delta : the transition function expressed as a dictionary