Skip to content

Instantly share code, notes, and snippets.

@TonyPythoneer
TonyPythoneer / q2.yaml
Last active March 6, 2024 18:29
CKAD Lightning Lab - Part 1
"""
Create a Persistent Volume called log-volume. It should make use of a storage class name manual. It should use RWX as the access mode and have a size of 1Gi. The volume should use the hostPath /opt/volume/nginx
Next, create a PVC called log-claim requesting a minimum of 200Mi of storage. This PVC should bind to log-volume.
Mount this in a pod called logger at the location /var/www/nginx. This pod should use the image nginx:alpine.
"""
apiVersion: v1
kind: PersistentVolume
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
IS_DEBUG = False
text_sample = "Peter told me that peter the pickle piper piped a pitted pickle before he petered out. Phew!"
no_output_text = '<No Output>'
testing_dataset = [
@TonyPythoneer
TonyPythoneer / cloudSettings
Last active August 10, 2018 02:46
Visual Studio Code Settings Sync Gist
{"lastUpload":"2018-08-10T02:46:04.500Z","extensionVersion":"v3.0.0"}
import asyncio
import json
import aiohttp
import zlib
TOKEN = ""
URL = "https://discordapp.com/api"
async def api_call(path, method="GET", **kwargs):
"""Return the JSON body of a call to Discord REST API."""
def solution(A, B, K):
qa, ra = divmod(A, K)
qb, rb = divmod(B, K)
count = qb - qa
if (qa >= 0 and ra == 0):
count += 1
return count
repos:
- repo: git://github.com/pre-commit/pre-commit-hooks
sha: v0.8.0
hooks:
- id: trailing-whitespace
exclude: \.(js|html)$
- id: flake8
language_version: python2.7
args:
- --exclude=*/*migrations/*
@TonyPythoneer
TonyPythoneer / note.md
Created May 16, 2017 04:19
How to use basic programming skill to improve your code

Please good use of programming basic skills

Do you know what recursive, IIFE, ternary operation, and short circuit are? A basic-level developer/programmer should know these skills which can make you code simplify so much.

First, let's look this code:

checkError(obj) {
    let errorMessage = ''
    if (!_.isNull(obj)) {
# coding=utf-8
cond = True
def a(t):
t = t if cond else t.encode('utf-8')
return t
def b(t):
if not cond:
import * as http from 'http';
import { MongoClient, Db, Collection } from 'mongodb';
import { Observable, Observer } from 'rxjs';
const URI = '';
const getDb = (uri: string) => {
console.log('Connect!!!!');