Skip to content

Instantly share code, notes, and snippets.

View damilare's full-sized avatar
🎯
Focusing

Damilare Onajole damilare

🎯
Focusing
View GitHub Profile
@damilare
damilare / cleanup.py
Last active April 3, 2020 00:17
Tweeting is like real world conversations. People don't usually record what they say, so it might be a good idea to clean-up your tweets every now and then.
""" 1) Download python twitter library from https://github.com/sixohsix/twitter
2) Go to dev.twitter.com creaate an application and genenrate tokens
3) Setup your tokens below
4) python cleanup.py and your tweets are gone!
"""
from twitter import *
t = Twitter(
auth=OAuth('--your-access-token-here',
@damilare
damilare / clone_or_update_repo.py
Created April 15, 2019 15:42
Clone all repost, or update its master branch
import os
import subprocess
with open('repos.txt') as f:
for repo in f.readlines():
dir_name = repo.split('/')[1].split('.')[0]
if os.path.exists(dir_name):
print("Updating ... %s" % dir_name)
subprocess.run(['git', '-C', dir_name, 'checkout', 'master'])
subprocess.run(['git', '-C', dir_name, 'pull', 'origin', 'master'])
@damilare
damilare / data-interchange.md
Created March 19, 2019 18:18 — forked from evancz/data-interchange.md
Why do I have to write JSON decoders in Elm?

A vision for data interchange in Elm

How do you send information between clients and servers? What format should that information be in? What happens when the server changes the format, but the client has not been updated yet? What happens when the server changes the format, but the database cannot be updated?

These are difficult questions. It is not just about picking a format, but rather picking a format that can evolve as your application evolves.

Literature Review

By now there are many approaches to communicating between client and server. These approaches tend to be known within specific companies and language communities, but the techniques do not cross borders. I will outline JSON, ProtoBuf, and GraphQL here so we can learn from them all.

@damilare
damilare / macronutrientcalc.py
Last active January 23, 2017 10:00
Calculate your recommended calorie intake, and macronutrient ratio based on your weight and your level of activity
import sys
import math
"""
To use, just run python macronutrientcalc.py <body weight in kg> <lifestyle between 10 and 20>
"""
def _(num, numbers):
return math.floor((num / numbers) * 100)
@damilare
damilare / System Design.md
Created May 3, 2016 06:10 — forked from vasanthk/System Design.md
System Design Cheatsheet

#System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

##Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
"""
The MIT License (MIT)
Copyright (c) 2011 Numan Sachwani
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
def __unicode__(self):
try:
return '{0}'.format(self.name)
except UnicodeError:
return ''
@damilare
damilare / esb_solutions.txt
Last active December 10, 2015 22:18
ESB Solutions
h1. The Plan
The plan is to make the next generation of WebCore into something greater -- something beyond the current web frameworks. Something that web functionality is just one part of. A service component framework that facilitates modularity and code reuse.
h1. Sources of Inspiration
Some existing projects can be used as sources of inspiration for the design of this component framework. Those include:
* "Jenkins":http://jenkins-ci.org/ for its web interface and plugin system
* "Mule":http://www.mulesoft.org/ and "Apache ServiceMix":https://servicemix.apache.org/ as the leading open source ESBs in the world
# The first Django site to run on Python 3!
# Copyright (c) 2012 Aymeric Augustin
# License: https://github.com/django/django/blob/master/LICENSE
import os
import sys
import django
from django.conf.urls.defaults import patterns
from django.http import HttpResponse, HttpResponseNotFound, HttpResponseServerError
@damilare
damilare / plugins.py
Created July 22, 2012 09:59
Load Plugin
if settings.TWITTER_INTEGRATION_ENABLED:
js_files.append('components/twitter.js')
if settings.GITHUB_INTEGRATION_ENABLED:
js_files.append('components/github.js')
if settings.DRIBBBLE_INTEGRATION_ENABLED:
js_files.append('components/dribbble.js')
if settings.INSTAGRAM_INTEGRATION_ENABLED: