Skip to content

Instantly share code, notes, and snippets.

@mokua
mokua / gist:8dc9662235526212164422270aaafcdf
Created January 18, 2023 11:18
python 7z file format
https://py7zr.readthedocs.io/en/latest/user_guide.html
pip install py7zr
python -m py7zr x /kaggle/input/cifar-10/test.7z /kaggle/data/cifar-10/
python -m py7zr x /kaggle/input/cifar-10/train.7z /kaggle/data/cifar-10/
@mokua
mokua / System Design.md
Created November 10, 2021 18:42 — forked from vasanthk/System Design.md
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@mokua
mokua / rust-101.rs
Last active November 7, 2020 11:34
rust 101
Variables and Mutability
-------------
let x = 9; // immutable variable
//x = 10 // error can assign to a mutable variable
let mut y = 19; //mutable variable
y = 20; //we can assign another value
//constants
@mokua
mokua / psql.md
Created November 4, 2020 13:08 — forked from cimmanon/psql.md
PostgreSQL cheat sheet for MySQL users

I use PostgreSQL via the psql client. If you use a different client (eg. pgAdmin, etc.), I don't know how much will translate over.

One nice difference between psql and mysql (cli) is that if you press CTRL+C, it won't exit the client.

User administration

Login as superuser (via shell)

psql -U postgres
@mokua
mokua / init-letsencrypt.sh
Created August 27, 2020 11:24
letsencrypt init file
#!/bin/bash
domains=(test.domain.com www.test.domain.com)
rsa_key_size=4096
data_path="./data/certbot"
email="put-email-address" # Adding a valid address is strongly recommended
staging=1 # Set to 1 if you're testing your setup to avoid hitting request limits
if [ -d "$data_path" ]; then
read -p "Existing data found for $domains. Continue and replace existing certificate? (y/N) " decision
brew install coreutils
export PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"
@mokua
mokua / client.go
Created July 14, 2020 05:48 — forked from xjdrew/client.go
golang tls client and server, require and verify certificate in double direction
package main
import (
"crypto/tls"
"crypto/x509"
"flag"
"io"
"io/ioutil"
"log"
"os"
@mokua
mokua / local k8s builds
Created July 8, 2020 11:41
k8s local build workflow
install kind https://kind.sigs.k8s.io/
get k8s source code : go get -d k8s.io/kubernetes
build the k8s image: kind build node-image --image=local:master
create a cluster using the image: kind create cluster --config kind-config.yaml --image=local:master
test the cluster : kubectl create deployment nginx --image=nginx
@mokua
mokua / standalone.xml
Created July 24, 2018 13:12
add gzip and cache static content for wildfly 11
<subsystem xmlns="urn:jboss:domain:undertow:4.0">
<buffer-cache name="default"/>
<server name="default-server">
<http-listener name="default" socket-binding="http" redirect-socket="https" enable-http2="true"/>
<https-listener name="https" socket-binding="https" security-realm="ApplicationRealm" enable-http2="true"/>
<host name="default-host" alias="localhost">
<location name="/" handler="welcome-content"/>
<filter-ref name="server-header"/>
<filter-ref name="x-powered-by-header"/>
<filter-ref name="gzipFilter" predicate="regex[pattern='text/html|text/css|application/javascript|application/json|image/jpeg|application/octet-stream|image/png|application/font-woff2',value=%{o,Content-Type}] and max-content-size[value=1024]"/>