Skip to content

Instantly share code, notes, and snippets.

View ZoeLiao's full-sized avatar

Liao, Jo-Yu (Zoe) ZoeLiao

View GitHub Profile
@iros
iros / API.md
Created August 22, 2012 14:42
Documenting your REST API

Title

<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>

  • URL

    <The URL Structure (path only, no root url)>

  • Method:

Markdown and reStructuredText

GitHub supports several lightweight markup languages for documentation; the most popular ones (generally, not just at GitHub) are Markdown and reStructuredText. Markdown is sometimes considered easier to use, and is often preferred when the purpose is simply to generate HTML. On the other hand, reStructuredText is more extensible and powerful, with native support (not just embedded HTML) for tables, as well as things like automatic generation of tables of contents.

@dryan
dryan / settings.py
Last active September 7, 2023 11:04
Handling EC2 ELB health checks and Django's ALLOWED_HOSTS setting.
# Hosts/domain names that are valid for this site; required if DEBUG is False
# See https://docs.djangoproject.com/en/1.5/ref/settings/#allowed-hosts
ALLOWED_HOSTS = [
'yourdomain.tld',
'.compute-1.amazonaws.com', # allows viewing of instances directly
]
import requests
EC2_PRIVATE_IP = None
try:
@henriquemenezes
henriquemenezes / postgresql-set-id-seq.sql
Created March 31, 2016 12:23
PostgreSQL set Next ID Sequence Value to MAX(id) from Table
-- Get Max ID from table
SELECT MAX(id) FROM table;
-- Get Next ID from table
SELECT nextval('table_id_seq');
-- Set Next ID Value to MAX ID
SELECT setval('table_id_seq', (SELECT MAX(id) FROM table));
@za
za / vim-flake8.md
Last active June 2, 2021 18:41
Step-by-step on setting up vim-flake8

This is how to automatically check your Python code style to comply with PEP8 when you use vim as your text editor. The first thing to do is, make sure you have vim running 😁

$ vim

You need to setup vim-pathogen first:

$ mkdir -p ~/.vim/autoload ~/.vim/bundle && curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim
@bmurithi
bmurithi / AnsibleTooManyAuthenticationFailures.md
Last active January 10, 2024 14:26
Ansible SSH too many authentication failures

This exception appears to affect ansible when a playbook is executed from a host with several identities configured in the SSH agent (Tested on a development machine with 12 private keys).

I've noted this exception to be particulary common with AWS targets

Inventory configuration

Most tasks will run fine when we configure our inventory to use a specific private key.

We also need to set the IdentitiesOnly flag so that ssh does not attempt other authentication strategies.

@xirixiz
xirixiz / Set up GitHub push with SSH keys.md
Last active November 18, 2024 12:44 — forked from developius/README.md
Set up GitHub push with SSH keys

SSH keypair setup for GitHub (or GitHub/GitLab/BitBucket, etc, etc)

Create a repo.

Make sure there is at least one file in it (even just the README.md)

Generate a SSH key pair (private/public):

ssh-keygen -t rsa -C "[email protected]"
@ameenkhan07
ameenkhan07 / FB-PE-InterviewTips.md
Last active November 15, 2024 04:04
Facebook Production Engineering Interview

What to Expect and Tips

• 45-minute systems interview, focus on responding to real world problems with an unhealthy service, such as a web server or database. The interview will start off at a high level troubleshooting a likely scenario, dig deeper to find the cause and some possible solutions for it. The goal is to probe your knowledge of systems at scale and under load, so keep in mind the challenges of the Facebook environment.
• Focus on things such as tooling, memory management and unix process lifecycle.

Systems

More specifically, linux troubleshooting and debugging. Understanding things like memory, io, cpu, shell, memory etc. would be pretty helpful. Knowing how to actually write a unix shell would also be a good idea. What tools might you use to debug something? On another note, this interview will likely push your boundaries of what you know (and how to implement it).

Design/Architecture 

Interview is all about taking an ambiguous question of how you might build a system and letting

@o2b-ru
o2b-ru / bigdata_table.py
Last active January 16, 2024 06:17
BigDataTable faster LongTable on the big data (reportlab==3.5.23)
import reportlab
from reportlab import platypus
from reportlab.lib.utils import annotateException, IdentStr, flatten, isStr, asNative, strTypes
class BigDataTable(platypus.Table):
def _splitRows(self, availHeight):
n = self._getFirstPossibleSplitRowPosition(availHeight)
repeatRows = self.repeatRows
if n <= (repeatRows if isinstance(repeatRows, int) else (max(repeatRows) + 1)): return []