Skip to content

Instantly share code, notes, and snippets.

View jonathanbarton's full-sized avatar

Jonathan Barton jonathanbarton

View GitHub Profile
@jonathanbarton
jonathanbarton / giphy.py
Last active January 5, 2017 01:00
giphy.py
import giphypop
import urllib
import os
FILE_TYPE = '.gif'
BASE_PATH = os.environ.get('BASE_PATH') or '/usr/local/mhe-dashboard'
GIF_COUNT = os.environ.get('GIF_COUNT') or 20
DAYS_TO_KEEP = 5
def get_filename(media_url):
@jonathanbarton
jonathanbarton / steps_for_rollback
Created August 18, 2016 20:04
STEPS FOR ROLLBACK
1. ) Take backup/snapshot of current data AND schema for current PROD database:
dledimsum-prod-aurora
2. ) Export data for dimsum.productEnrollments view -> .sql file
3.) Perform code rollback steps
4.) Create new database with name dledimsum-prod-120-aurora
5. Restore last Datapipe snapshot from dledimsum-prod-aurora into dledimsum-prod-120-aurora (referenced during call as UTC 8-17 PM time)
@jonathanbarton
jonathanbarton / gomake-telemetry.service.md
Last active July 23, 2016 23:41
gomake-telemetry.service systemd script

Create service config file:

sudo nano /lib/systemd/system/gomake-telemetry.service

/lib/systemd/system/gomake-telemetry.service contents:

[Unit]
Description=goMake Telemetry Service
After=multi-user.target
@jonathanbarton
jonathanbarton / sort_algorithms_javascript
Created May 2, 2016 01:50
sort_algorithms_javascript
//Insertion Sort
https://jsfiddle.net/0sxhch8d/
@jonathanbarton
jonathanbarton / simple_programming_problems
Last active June 5, 2021 11:21
simple_programming_problems
Elementary
Write a program that prints ‘Hello World’ to the screen.
Write a program that asks the user for her name and greets her with her name.
Modify the previous program such that only the users Alice and Bob are greeted with their names.
Write a program that asks the user for a number n and prints the sum of the numbers 1 to n
Modify the previous program such that only multiples of three or five are considered in the sum, e.g. 3, 5, 6, 9, 10, 12, 15 for n=17
Write a program that asks the user for a number n and gives him the possibility to choose between computing the sum and computing the product of 1,…,n.
Write a program that prints a multiplication table for numbers up to 12.
Write a program that prints all prime numbers. (Note: if your programming language does not support arbitrary size numbers, printing all primes up to the largest number you can easily represent is fine too.)
@jonathanbarton
jonathanbarton / weird_request_buffer
Created March 29, 2016 21:58
weird_request_buffer
function authenticate(req, res) {
let options = {
method: 'POST',
url: 'http://connected-qa.cdiapps.com/api/v0.1/session',
headers: {
'content-type': 'application/json',
'accept': 'application/json',
'accept-encoding': 'gzip, deflate',
'accept-language': 'en-US,en;q=0.8,ja;q=0.6'
@jonathanbarton
jonathanbarton / selection_sort_problem
Created March 14, 2016 23:45
selection_sort_problem
function selectionSort(arr, currentMin) {
while(currentMin === undefined || currentMin < arr.length) {
currentMin = currentMin || 0;
for(var i = currentMin; i < arr.length; i++){
if(arr[currentMin] > arr[i]){
var a=arr[currentMin],b=arr[i];
b = [a, a = b][0];
arr[currentMin] = a;
arr[i] = b;
}
@jonathanbarton
jonathanbarton / alternating_arrays_problem
Created March 14, 2016 19:28
simple_programming_problem_lists_strings_10: Alternating Arrays
var arr1 = ['a','b','c'];
var arr2 = ['r','t','z','f'];
var alternateArray = function(a, b) {
var i = 0, result = [];
while(a[i] || b[i]) {
if(a[i]){
result.push(a[i]);
}
if(b[i]){
@jonathanbarton
jonathanbarton / esp8266_intro.md
Last active March 28, 2024 19:50
ESP8266 Introduction

#Overview

The ESP8266 is a versatile chipset that provides client and access point wifi capabilities, on-chip SRAM and flash storage, a RISC processor, GPIO pins, and pin outs for memory and CPU extensability. Bundled as a series of modules with varying features focused around acting as either a wifi extension module to an existing microcontroller or as an self-contained solution for integrating wifi and internet functionality with GPIO control. From an application standpoint, the ESP weighs in as an inexpensive and compact alternative to AVR (arduino) based, wifi-driven IoT solutions.

Chip Layout

AT Command Set

AT+RST restart the module, received some strange data, and "ready"

@jonathanbarton
jonathanbarton / week4_assignment.md
Last active August 29, 2015 14:28
Week 4 Assignment

#Week 4 Assignment

Description

We will be creating an app with a table view that displays 3 animals in its list (default: tiger, bear, eagle), and the user can also add a new animal to the list.

Definition of Done

  • All Acceptance Criteria met
  • Project runs and all items are functioning
  • Project solution pushed out to proper branch and pull request opened

Project Setup