Skip to content

Instantly share code, notes, and snippets.

View gbozee's full-sized avatar
🎯
Focusing

Abiola gbozee

🎯
Focusing
View GitHub Profile
#!/bin/bash
# Authorize TCP, SSH & ICMP for default Security Group
#ec2-authorize default -P icmp -t -1:-1 -s 0.0.0.0/0
#ec2-authorize default -P tcp -p 22 -s 0.0.0.0/0
# The Static IP Address for this instance:
IP_ADDRESS=$(cat ~/.ec2/ip_address)
# Create new t1.micro instance using ami-cef405a7 (64 bit Ubuntu Server 10.10 Maverick Meerkat)
using Microsoft.Phone.Controls;
using System;
using System.Windows.Controls.Primitives;
/// <summary>
/// This class detects the pull gesture on a LongListSelector. How does it work?
///
/// This class listens to the change of manipulation state of the LLS, to the MouseMove event
/// (in WP, this event is triggered when the user moves the finger through the screen)
/// and to the ItemRealized/Unrealized events.
def cycle_key(self):
#TODO: Errors here will tank the system, probably need some better handling...
old_session_key = self.session_key
old_session = Session.objects.get(session_key=old_session_key)
try:
cart = Cart.objects.get(session=old_session)
super(SessionStore, self).cycle_key()
new_session_key = self.session_key
new_session = Session.objects.get(session_key=new_session_key)
cart.session = new_session
@gbozee
gbozee / pg-aws-backups.md
Created January 31, 2017 06:24 — forked from tylor/pg-aws-backups.md
Weekly backups of PostgreSQL database to Amazon S3

Weekly backups of PostgreSQL database to Amazon S3

  1. I did this as root: $ sudo su, although it may not be necessary.
  2. Download AWS command line tools: $ curl https://raw.github.com/timkay/aws/master/aws -o aws
  3. Install:
    • Automatically: $ perl --install aws
    • Manually: $ mv aws /usr/local/bin/ && chmod +x /usr/local/bin/aws
@gbozee
gbozee / README-Template.md
Created March 29, 2017 14:36 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@gbozee
gbozee / fizzbuzz.py
Created October 7, 2017 17:35
Testing Python programs with unittest
import unittest
class FizzBuzzException(Exception):
pass
def fizz_buzz(param):
result = ""
try:
variable = int(param)
except ValueError:
import csv
def get_input(passed):
"""This function converts a string to an integer
and returns None when the string isn't an integer"""
try:
number_of_courses = int(passed)
except ValueError:
number_of_courses = None
return number_of_courses
@gbozee
gbozee / setup.md
Last active December 14, 2017 16:02
Code Used for Serverside rendering
$ npm install -g create-react-app
$ create-react-app frontend
$ cd frontend
$ yarn add react-router-dom styled-components react-loadable react-app-rewired
$ touch config-overrides.js
@gbozee
gbozee / package.json
Created December 14, 2017 16:07
Editing package.json with React app rewired and adding other
{
"name": "frontend",
"version": "0.1.0",
"private": true,
"dependencies": {
"react": "^16.2.0",
"react-dom": "^16.2.0",
"react-loadable": "^5.3.1",
"react-router-dom": "^4.2.2",
"react-scripts": "1.0.17",
@gbozee
gbozee / a script.md
Last active December 14, 2017 16:20
extends Default Create react app webpack config
$ yarn add --dev dynamic-cdn-webpack-plugin # load react from a cdn when built in production mode
$ yarn add --dev module-to-cdn # required by dynamic-cdn-webpack-plugin
$ yarn add --dev react-app-rewire-preact # install preact-compat
$ yarn add --dev react-app-rewire-styled-components # ability to use babel plugin of styled-components
$ yarn add --dev preload-webpack-plugin # ability to prefetch all code splitted routes/components.