Skip to content

Instantly share code, notes, and snippets.

View derek-adair's full-sized avatar
🎯
Starting a thing

Derek derek-adair

🎯
Starting a thing
View GitHub Profile
@derek-adair
derek-adair / Dockerfile
Last active September 28, 2015 16:53
Docker Compose example
View Dockerfile
FROM python:2.7
ADD . /code
WORKDIR /code
RUN pip install -r requirements.txt
CMD python app.py
@derek-adair
derek-adair / tornado_asyncio.py
Created February 18, 2016 18:00 — forked from drgarcia1986/tornado_asyncio.py
Tornado and Asyncio Mixed example
View tornado_asyncio.py
# -*- coding: utf-8 -*-
import asyncio
import re
import asyncio_redis
import tornado.concurrent
import tornado.httpclient
import tornado.web
import tornado.platform.asyncio
View Simple aiohttp web sraper
#requires aiohttp - navigate to localhost:8080/?domain={domain_to_scrape}
from aiohttp import web
import aiohttp
import asyncio
async def handle(request):
domain = '//{}'.format(request.GET['domain'])
loop = asyncio.get_event_loop()
with aiohttp.ClientSession(loop=loop) as session:
print("fetching from {}".format(domain))
View gist:03319997e5162df0ea8935afc3efdda9
version: '2'
services:
hub:
image: selenium/hub:${SEL_VERSION}
ports:
- "4444:4444"
firefox:
image: selenium/node-firefox:${SEL_VERSION}
volumes:
View manage.py loaddata website_data.json error
ceback (most recent call last):
File "manage.py", line 7, in <module>
startup.manage(path=os.path.dirname(os.path.abspath(__file__)))
File "/virtualenv/lib/python3.5/site-packages/aldryn_django/startup.py", line 11, in manage
utility.execute()
File "/virtualenv/lib/python3.5/site-packages/django/core/management/__init__.py", line 346, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/virtualenv/lib/python3.5/site-packages/django/core/management/base.py", line 394, in run_from_argv
self.execute(*args, **cmd_options)
File "/virtualenv/lib/python3.5/site-packages/django/core/management/base.py", line 445, in execute
View gist:ea454a846efa06e2a919640ba1b4a0e4
`
### WordPress Environment ###
Home URL: https://**********
Site URL: https://**********
WC Version: 3.5.2
Log Directory Writable: ✔
WP Version: ❌ 4.9.8 - There is a newer version of WordPress available (5.0.3)
WP Multisite: –
WP Memory Limit: 768 MB
View gist:7b0d0598faf5f5dba574d453fd8ead32
//Object.keys returns an array like ['username/clipname': {name: clipname, mp3_file:<link_to_mp3>}]
userClips = Object.keys(clips)
// filter the array to only include those that start with the username
.filter(clip => !clip.indexOf(`${username}/`))
// reduces the original object key array using object explode syntax
.reduce((obj, key)=>{
return {
// obj is exploded, its the accumulation of the reduce
...obj,
// inserts the clip into the accumulator
View gist:79760c0435360c9523df0558769331ac
let
newState = Object.assign({}, state),
library_clips = newState.library[action.library_owner].clips,
clip_index = library_clips.indexOf(`${action.clip.user}/${action.clip.name}`)
;
library_clips.splice(clip_index, 1)
return newState
View new play by play feed
{
"gameSchedule":{
"season":2018,
"seasonType":"PRE",
"week":1,
"gameId":2018080951,
"gameKey":57504,
"gameDate":"08/09/2018",
"gameTimeEastern":"19:30:00",
"gameTimeLocal":"19:30:00",
@derek-adair
derek-adair / vim_with_python.sh
Last active March 25, 2020 16:55
Compile and install vim w/ YouCompleteMe
View vim_with_python.sh
#Install the deps
sudo apt install libncurses5-dev libgnome2-dev libgnomeui-dev \
libgtk2.0-dev libatk1.0-dev libbonoboui2-dev \
libcairo2-dev libx11-dev libxpm-dev libxt-dev python-dev \
python3-dev ruby-dev lua5.1 liblua5.1-dev libperl-dev git
#Remove all the vims
sudo apt remove vim vim-runtime gvim vim-tiny vim-common
# Make sure they are alllll gone