Skip to content

Instantly share code, notes, and snippets.

View alazycoder101's full-sized avatar

Lazy coder alazycoder101

View GitHub Profile
@alazycoder101
alazycoder101 / alias_matchers.md
Created April 11, 2024 18:42 — forked from JunichiIto/alias_matchers.md
List of alias matchers in RSpec 3

This list is based on aliases_spec.rb.

You can see also Module: RSpec::Matchers API.

matcher aliased to description
a_truthy_value be_truthy a truthy value
a_falsey_value be_falsey a falsey value
be_falsy be_falsey be falsy
a_falsy_value be_falsey a falsy value

Flaky Test

Cause of the problem

Date Timezone

Timezone

When your system is support timezone, usually it will become complicated.

  • Timezone in DB
  • Timezone in App
  • Timezone on machine
@alazycoder101
alazycoder101 / generate-wildcard-certificate.sh
Created July 9, 2023 22:42 — forked from dmadisetti/generate-wildcard-certificate.sh
Generate self-signed wildcard SSL certificate for development environment
#!/usr/bin/env bash
# print usage
DOMAIN=$1
if [ -z "$1" ]; then
echo "USAGE: $0 tld"
echo ""
echo "This will generate a non-secure self-signed wildcard certificate for "
echo "a given development tld."
echo "This should only be used in a development environment."
# https://stackoverflow.com/questions/52422300/how-to-schedule-pods-restart
---
# Service account the client will use to reset the deployment,
# by default the pods running inside the cluster can do no such things.
kind: ServiceAccount
apiVersion: v1
metadata:
name: deployment-restart
namespace: <namespace>
---

Create an GCS bucket

BUCKET=my-dev-k8s gsutil mb gs://$BUCKET/

Set permissions with a Service Account

# View your current config settings:
gcloud config list
PROJECT_ID=$(gcloud config get-value project)

Performance

Getting-Started

  1. Browsre -> Load balancer
<?xml version="1.0" encoding="UTF-8"?>
<!-- OPML generated by NetNewsWire -->
<opml version="1.1">
<head>
<title>Subscriptions-OnMyMac.opml</title>
</head>
<body>
<outline text="Allen Pike" title="Allen Pike" description="" type="rss" version="RSS" htmlUrl="" xmlUrl="https://feeds.allenpike.com/feed/"/>
<outline text="BBC News - World" title="BBC News - World" description="" type="rss" version="RSS" htmlUrl="https://www.bbc.co.uk/news/" xmlUrl="https://feeds.bbci.co.uk/news/world/rss.xml"/>
<outline text="Colossal" title="Colossal" description="" type="rss" version="RSS" htmlUrl="https://www.thisiscolossal.com/" xmlUrl="https://www.thisiscolossal.com/feed/"/>

How to debug docker build with Dockerfile

  1. delete the following part causing errors
FROM busybox
RUN echo 'hello world'

RUN exit 1
....
@alazycoder101
alazycoder101 / tcp-no-delay-benchmark.rb
Last active April 27, 2023 10:21 — forked from dylanahsmith/tcp-no-delay-benchmark.rb
Benchmarking Net::HTTP with and without keep-alive and TCP_NODELAY
#!/usr/bin/env ruby
require 'net/http'
require 'net/http/persistent' # gem install net-http-persistent
require 'benchmark'
class HttpNoTcpDelay < Net::HTTP
def on_connect
@socket.io.setsockopt(Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1)
nil