Skip to content

Instantly share code, notes, and snippets.

@joffilyfe
joffilyfe / System Design.md
Last active September 2, 2021 22:28 — 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?
@joffilyfe
joffilyfe / beautiful_idiomatic_python.md
Created March 2, 2018 22:32 — forked from 0x4D31/beautiful_idiomatic_python.md
Transforming Code into Beautiful, Idiomatic Python: notes from Raymond Hettinger's talk at pycon US 2013. The code examples and direct quotes are all from Raymond's talk. I've reproduced them here for my own edification and the hopes that others will find them as handy as I have!

Transforming Code into Beautiful, Idiomatic Python

Notes from Raymond Hettinger's talk at pycon US 2013 video, slides.

The code examples and direct quotes are all from Raymond's talk. I've reproduced them here for my own edification and the hopes that others will find them as handy as I have!

Looping over a range of numbers

for i in [0, 1, 2, 3, 4, 5]:
@joffilyfe
joffilyfe / fix-wordpress-permissions.sh
Created March 2, 2018 00:26 — forked from Adirael/fix-wordpress-permissions.sh
Fix wordpress file permissions
#!/bin/bash
#
# This script configures WordPress file permissions based on recommendations
# from http://codex.wordpress.org/Hardening_WordPress#File_permissions
#
# Author: Michael Conigliaro <mike [at] conigliaro [dot] org>
#
WP_OWNER=www-data # <-- wordpress owner
WP_GROUP=www-data # <-- wordpress group
WP_ROOT=$1 # <-- wordpress root directory
@joffilyfe
joffilyfe / fabfile.py
Created April 7, 2017 22:29 — forked from mahmoudimus/fabfile.py
fabric deployment example
from fabric.api import env, run, sudo, local, put
def production():
"""Defines production environment"""
env.user = "deploy"
env.hosts = ['example.com',]
env.base_dir = "/var/www"
env.app_name = "app"
env.domain_name = "app.example.com"
env.domain_path = "%(base_dir)s/%(domain_name)s" % { 'base_dir':env.base_dir, 'domain_name':env.domain_name }
namespace :figaro do
desc "SCP transfer figaro configuration to the shared folder"
task :setup do
on roles(:app) do
upload! "config/application.yml", "#{shared_path}/application.yml", via: :scp
end
end
desc "Symlink application.yml to the release path"
task :symlink do
@joffilyfe
joffilyfe / golang_job_queue.md
Created December 27, 2016 03:27 — forked from harlow/golang_job_queue.md
Job queues in Golang
@joffilyfe
joffilyfe / carrierwave.rb
Created July 14, 2016 14:39 — forked from artemave/carrierwave.rb
minimagick carrierwave round image (with white border)
# config/initializers/carrierwave.rb
require 'mini_magick'
module CarrierWave
module MiniMagick
# round _square_ image
def round
manipulate! do |img|
img.format 'png'
@joffilyfe
joffilyfe / classi.py
Last active August 29, 2015 14:07 — forked from thiagopnts/classi.py
from math import sqrt
from heapq import heappush, heappop, nsmallest
class Point:
def __init__(self, coord, data=None):
self.coord = coord
self.data = data
self.dest = None