Skip to content

Instantly share code, notes, and snippets.

View MEOWMEOW114's full-sized avatar
🎯
Focusing on learning kubernetes/devops

Tom Lee MEOWMEOW114

🎯
Focusing on learning kubernetes/devops
  • Hong Kong
View GitHub Profile
@MEOWMEOW114
MEOWMEOW114 / us_state_abbreviations.py
Created March 9, 2023 02:11 — forked from JeffPaine/us_state_abbreviations.py
A python list of all US state abbreviations.
states = [ 'AK', 'AL', 'AR', 'AZ', 'CA', 'CO', 'CT', 'DC', 'DE', 'FL', 'GA',
'HI', 'IA', 'ID', 'IL', 'IN', 'KS', 'KY', 'LA', 'MA', 'MD', 'ME',
'MI', 'MN', 'MO', 'MS', 'MT', 'NC', 'ND', 'NE', 'NH', 'NJ', 'NM',
'NV', 'NY', 'OH', 'OK', 'OR', 'PA', 'RI', 'SC', 'SD', 'TN', 'TX',
'UT', 'VA', 'VT', 'WA', 'WI', 'WV', 'WY']
states = {
'AK': 'Alaska',
'AL': 'Alabama',
'AR': 'Arkansas',
@MEOWMEOW114
MEOWMEOW114 / sqlalchemy_example.py
Created September 4, 2022 14:15 — forked from ronreiter/sqlalchemy_example.py
SQLAlchemy Example
from sqlalchemy import Column, Integer, String, ForeignKey, create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import relationship, backref, sessionmaker, joinedload
# For this example we will use an in-memory sqlite DB.
# Let's also configure it to echo everything it does to the screen.
engine = create_engine('sqlite:///:memory:', echo=True)
# The base class which our objects will be defined on.
Base = declarative_base()
@MEOWMEOW114
MEOWMEOW114 / itunes.countries.js
Created August 30, 2021 01:34 — forked from daFish/itunes.countries.js
List of Apple iTunes Store Country codes in Javascript.
var countries = {
ae: 'United Arab Emirates',
ag: 'Antigua and Barbuda',
ai: 'Anguilla',
al: 'Albania',
am: 'Armenia',
ao: 'Angola',
ar: 'Argentina',
at: 'Austria',
au: 'Australia',
@MEOWMEOW114
MEOWMEOW114 / better-nodejs-require-paths.md
Created July 18, 2020 05:21 — forked from branneman/better-nodejs-require-paths.md
Better local require() paths for Node.js

Better local require() paths for Node.js

Problem

When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:

const Article = require('../../../../app/models/article');

Those suck for maintenance and they're ugly.

Possible solutions

@MEOWMEOW114
MEOWMEOW114 / boto3-list-instances.py
Created August 6, 2019 01:58 — forked from ableasdale/boto3-list-instances.py
Using Boto 3 to list out AWS EC2 instance information
import boto3
from termcolor import colored
ec2 = boto3.resource('ec2')
for i in ec2.instances.all():
print("Id: {0}\tState: {1}\tLaunched: {2}\tRoot Device Name: {3}".format(
colored(i.id, 'cyan'),
colored(i.state['Name'], 'green'),
@MEOWMEOW114
MEOWMEOW114 / kops-export-config.sh
Created May 17, 2019 17:40 — forked from jeffjohnson9046/kops-export-config.sh
How to update kubectl to see a new Kubernetes cluster
# This is something that I always forget and had a surprisingly hard time finding (or better yet, understanding). Here's the
# scenario: a colleague creates a new kubernetes cluster, named" cluster-foo.example.com". You want to look at it (for
# troubleshooting, updating the deployment, whatever). To get your kubectl installation to "see" the new cluster, take the
# following steps:
# ASSUMPTION: You have pointed kops to some location where the cluster configurations are stored
# (I have this in my ~/.bash_profile):
export KOPS_STATE_STORE=s3://example-state-store
# Use kops to get the list of clusters
@MEOWMEOW114
MEOWMEOW114 / latency.txt
Created February 20, 2019 16:12 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@MEOWMEOW114
MEOWMEOW114 / README.md
Created December 27, 2018 07:24 — forked from greyscaled/README.md
Sequelize + Express + Migrations + Seed Starter
from btgym import BTgymEnv
import IPython.display as Display
import PIL.Image as Image
from gym import spaces
import gym
import numpy as np
import random
@MEOWMEOW114
MEOWMEOW114 / async-await.js
Created December 18, 2018 06:50 — forked from wesbos/async-await.js
Simple Async/Await Example
// 🔥 Node 7.6 has async/await! Here is a quick run down on how async/await works
const axios = require('axios'); // promised based requests - like fetch()
function getCoffee() {
return new Promise(resolve => {
setTimeout(() => resolve('☕'), 2000); // it takes 2 seconds to make coffee
});
}