This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"math/rand" | |
"strings" | |
"testing" | |
) | |
var ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This file contains only configs which differ from defaults. | |
# All possible options can be found here https://github.com/golangci/golangci-lint/blob/master/.golangci.reference.yml | |
run: | |
# Timeout for analysis, e.g. 30s, 5m. | |
# Default: 1m | |
timeout: 3m | |
linters-settings: | |
cyclop: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pods() { | |
command='kubectl get pods --all-namespaces' fzf \ | |
--info=inline --layout=reverse --header-lines=1 \ | |
--prompt "$(kubectl config current-context | sed 's/-context$//')> " \ | |
--header $'╱ Enter (kubectl exec) ╱ CTRL-O (open log in editor) ╱ CTRL-R (reload) ╱\n\n' \ | |
--bind 'start:reload:$command' \ | |
--bind 'ctrl-r:reload:$command' \ | |
--bind 'ctrl-/:change-preview-window(80%,border-bottom|hidden|)' \ | |
--bind 'enter:execute:kubectl exec -it --namespace {1} {2} -- bash' \ | |
--bind 'ctrl-o:execute:${EDITOR:-vim} <(kubectl logs --all-containers --namespace {1} {2})' \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
t.tablename | |
FROM | |
pg_catalog.pg_tables t | |
LEFT JOIN pg_stat_user_tables stat ON t.tablename = stat.relname | |
WHERE | |
t.schemaname = 'public' -- Adjust this to your schema name if different | |
AND stat.n_live_tup = 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"context" | |
"log/slog" | |
"net/http" | |
"os" | |
"os/signal" | |
"syscall" | |
"time" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""High-level support for working with threads in asyncio""" | |
import asyncio | |
import contextvars | |
import functools | |
async def run_in_thread_async(executor, func, *args, **kwargs): | |
"""https://github.com/python/cpython/blob/main/Lib/asyncio/threads.py""" | |
loop = asyncio.get_running_loop() | |
ctx = contextvars.copy_context() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ***************************************************************************** | |
# CODING STYLE > MAKING YOUR CODE READABLE | |
# ***************************************************************************** | |
# 1. Avoid abbreviating variable names. | |
# 2. Write out your function argument names. | |
# 3. Document your classes and methods. | |
# 4. Comment your code. | |
# 5. Refactor repeated lines of code into reusable functions or methods. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"context" | |
"fmt" | |
"golang.org/x/sync/errgroup" | |
) | |
func race(ctx context.Context) ([]int, error) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
import SwiftUI | |
import Firebase | |
import AVFoundation | |
class AppDelegate: UIResponder, UIApplicationDelegate { | |
var window: UIWindow? | |
func application(_ application: UIApplication, | |
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dd if=/dev/urandom of=temp_20GB_file bs=1024 count=20971520 |
NewerOlder