Skip to content

Instantly share code, notes, and snippets.

View nextwebb's full-sized avatar
🏠
Working from home

Peterson Oaikhenah nextwebb

🏠
Working from home
View GitHub Profile
@nextwebb
nextwebb / scan.py
Created December 15, 2022 00:43 — forked from pgolding/scan.py
scan all elements from a dynamodb table using Python (boto3)
from __future__ import print_function # Python 2/3 compatibility
import boto3
import json
import decimal
from boto3.dynamodb.conditions import Key, Attr
# Helper class to convert a DynamoDB item to JSON.
class DecimalEncoder(json.JSONEncoder):
def default(self, o):
if isinstance(o, decimal.Decimal):
version: '2'
services:
redis:
image: redis:alpine
container_name: redis_db
command: redis-server --appendonly yes
ports:
- 6379:6379
volumes:
@nextwebb
nextwebb / gist:3e54d551e6bac60488294ce5b61dfc1f
Created December 5, 2020 19:51 — forked from pushmatrix/gist:6570585
How to get started building a ship tracking app.
- Find an API that supplies the data.
- I found the one that MarineTraffic.com uses (http://www.marinetraffic.com)
- Open your computer's terminal, and paste this:
curl 'http://www.marinetraffic.com/ais/getjson.aspx?sw_x=0&sw_y=70&ne_x=30&ne_y=80&zoom=6&fleet=&station=0&id=null' -H 'Referer: http://www.marinetraffic.com/ais/'
- This shows you all the data. You will now need to automate calling this API
- Get the data from the API using something like jQuery:
- Documentation: http://api.jquery.com/jQuery.getJSON/
- Tutorial :http://www.youtube.com/watch?v=3hN4PrJ7R6A
@nextwebb
nextwebb / LongestSubstring.py
Last active September 3, 2020 19:57
Longest Substring Without Repeating Characters
class Solution(object):
def lengthOfLongestSubstring(self, string: str) -> int:
sub = {}
cur_sub_start = 0
cur_len = 0
longest = 0
for i, letter in enumerate(string):
if letter in sub and sub[letter] >= cur_sub_start:
cur_sub_start = sub[letter] + 1
@nextwebb
nextwebb / django_crash_course.MD
Created June 19, 2020 01:55 — forked from bradtraversy/django_crash_course.MD
Commands for Django 2.x Crash Course

Django Crash Course Commands

# Install pipenv
pip install pipenv
# Create Venv
pipenv shell
@nextwebb
nextwebb / eslint_prettier_airbnb.md
Created March 6, 2020 04:48 — forked from bradtraversy/eslint_prettier_airbnb.md
ESLint, Prettier & Airbnb Setup

VSCode - ESLint, Prettier & Airbnb Setup

1. Install ESLint & Prettier extensions for VSCode

Optional - Set format on save and any global prettier options

2. Install Packages

npm i -D eslint prettier eslint-plugin-prettier eslint-config-prettier eslint-plugin-node eslint-config-node
@nextwebb
nextwebb / inTheLifeMediaSearch.php
Created September 22, 2019 02:16 — forked from johnschimmel/inTheLifeMediaSearch.php
PHP SOAP request using CURL to retrieve In The Life Station listings
<?php
function getListingsViaSoap($zipcode) {
$url = "http://www.tracmedia.com/lol/LOLService.asmx";
$soap_request = '<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<InTheLife xmlns="http://tracmedia.org/">

POSTGRESQL CHEATSHEET

Basic commands

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@nextwebb
nextwebb / youtube-dl-download-pluralsight.md
Created May 16, 2019 02:15 — forked from munim/youtube-dl-download-pluralsight.md
youtube-dl to download pluralsight videos

Download Plural Sight videos

Software required:

youtube-dl

After installation and putting the youtube-dl in PATH

youtube-dl \