Skip to content

Instantly share code, notes, and snippets.

View littlebeeper's full-sized avatar

Cuneyt Ozen littlebeeper

View GitHub Profile
@usr-ein
usr-ein / Dockerfile
Last active September 12, 2024 13:50
Optimal multistaged Dockerfile for poetry
# syntax=docker/dockerfile:1
# Keep this syntax directive! It's used to enable Docker BuildKit
# Based on https://github.com/python-poetry/poetry/discussions/1879?sort=top#discussioncomment-216865
# but I try to keep it updated (see history)
################################
# PYTHON-BASE
# Sets up all our shared environment variables
################################
@ssrihari
ssrihari / clojure-learning-list.md
Last active August 27, 2024 08:55
An opinionated list of excellent Clojure learning materials

An opinionated list of excellent Clojure learning materials

These resources (articles, books, and videos) are useful when you're starting to learn the language, or when you're learning a specific part of the language. This an opinionated list, no doubt. I've compiled this list from writing and teaching Clojure over the last 10 years.

  • 🔴 Mandatory (for both beginners and intermediates)
  • 🟩 For beginners
  • 🟨 For intermediates

Table of contents

  1. Getting into the language
@didibus
didibus / complex_business_process_example.clj
Last active August 20, 2024 20:35
Example of a complex business process to implement in Clojure. Please link to your solutions for alternative ways to implement the same in Clojure (or other languages).
(ns complex-business-process-example
"A stupid example of a more complex business process to implement as a flowchart.")
;;;; Config
(def config
"When set to :test will trigger the not-boosted branch which won't write to db.
When set to :prod will trigger the boosted branch which will try to write to the db."
{:env :prod})
@technocake
technocake / pyclean.sh
Last active July 17, 2024 12:46
Clear all python cache in directory
# pyclean command to clear all python cache in a directory
# source: https://stackoverflow.com/questions/28991015/python3-project-remove-pycache-folders-and-pyc-files
# in .bash_profile / .bash_rc etc put:
pyclean () {
find . -type f -name '*.py[co]' -delete -o -type d -name __pycache__ -delete
}
@sarthology
sarthology / regexCheatsheet.js
Created January 10, 2019 07:54
A regex cheatsheet 👩🏻‍💻 (by Catherine)
let regex;
/* matching a specific string */
regex = /hello/; // looks for the string between the forward slashes (case-sensitive)... matches "hello", "hello123", "123hello123", "123hello"; doesn't match for "hell0", "Hello"
regex = /hello/i; // looks for the string between the forward slashes (case-insensitive)... matches "hello", "HelLo", "123HelLO"
regex = /hello/g; // looks for multiple occurrences of string between the forward slashes...
/* wildcards */
regex = /h.llo/; // the "." matches any one character other than a new line character... matches "hello", "hallo" but not "h\nllo"
regex = /h.*llo/; // the "*" matches any character(s) zero or more times... matches "hello", "heeeeeello", "hllo", "hwarwareallo"
@rordi
rordi / docker-debug.md
Last active July 15, 2024 20:30
Docker debugging an existing image

Debugging a Docker image

Start up the Docker container from image:

docker run --entrypoint "/bin/sh" --rm imagename:latest -c "sleep 24h"

Obtain the container hash id:

docker ps
@ariesmcrae
ariesmcrae / CreditcardMasker.java
Last active September 2, 2020 15:27
This will mask the following credit cards: Visa, Mastercard, Amex, Diners, Discovery, JCB
/**
* This will mask a portion of a credit card with 'x' if it finds it in a sentence.
\b(?:
# Visa card number 4[\ -]*(?:\d[\ -]*){11}(?:(?:\d[\ -]*){3})?\d|
# MasterCard card number (?:5[\ -]*[1-5](?:[\ -]*\d){2}|(?:2[\
-]*){3}[1-9]|(?:2[\ -]*){2}[3-9][\ -]*\d|2[\ -]* [3-6](?:[\ -]*\d){2}|2[\
-]*7[\ -]*[01][\ -]*\d|2[\ -]*7[\ -]*2[\ -]*0)(?:[\ -]*\d){12}|
@wojteklu
wojteklu / clean_code.md
Last active September 21, 2024 05:38
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@hbsdev
hbsdev / clean_py.sh
Last active August 8, 2024 14:21 — forked from joelverhagen/clean_py.sh
Recursively remove all .pyc files and __pycache__ directories in the current directory.
#!/bin/sh
# recursively removes all .pyc files and __pycache__ directories in the current
# directory
find . | grep -E "(__pycache__|\.pyc$)" | xargs rm -rf
@garystafford
garystafford / v1-ubuntu-docker-node-apt-get.sh
Last active July 24, 2024 15:05
Install the latest versions of Node.js and npm into a Docker Ubuntu container, with or without need for root access. Easily update both applications to the latest versions. Creates a new user account ('testuser') and installs common npm packages.
###############################################################################
# Version 1: using ‘apt-get install’
# Installs using apt-get
# Requires update to npm afterwards
# Harder to get latest copy of node
# Requires sudo to use npm
###############################################################################
# create new docker ubuntu container
sudo docker run -i -t ubuntu /bin/bash # drops you into container as root