Skip to content

Instantly share code, notes, and snippets.

View mehdisadeghi's full-sized avatar

mehdisadeghi

View GitHub Profile
@m-radzikowski
m-radzikowski / script-template.sh
Last active April 25, 2024 18:43
Minimal safe Bash script template - see the article with full description: https://betterdev.blog/minimal-safe-bash-script-template/
#!/usr/bin/env bash
set -Eeuo pipefail
trap cleanup SIGINT SIGTERM ERR EXIT
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)
usage() {
cat <<EOF
Usage: $(basename "${BASH_SOURCE[0]}") [-h] [-v] [-f] -p param_value arg1 [arg2...]
@hikiko4ern
hikiko4ern / .bash_aliases
Last active October 29, 2023 20:24
Pikachu test passed (demo: https://asciinema.org/a/236096)
# /------------------------------------------\
# | don't forget to download the .tp file |
# | and place it in the user's directory :› |
# | |
# | also install lolcat: |
# | https://github.com/busyloop/lolcat |
# \------------------------------------------/
alias test-passed='if [ "$?" -eq "0" ]; then lolcat ~/.tp -a -s 40 -d 2; fi;'
@HyperBrain
HyperBrain / lifecycle-cheat-sheet.md
Last active March 20, 2024 00:17
Serverless Lifecycle Cheat Sheet

Serverless plugin author's cheat sheet

This cheat sheet provides a detailed overview of the exposed lifecycle events and available commands (and entrypoints) of the Serverless framework, that can be hooked by plugins (internal and external ones). The document is structured by the commands invoked by the user.

Lifecycle events are shown as the globally available outer events (all providers) and sub lifecycle events that are provider specific in the called order. Currently only the AWS provider is shown. If you have information about the other provider,

@thegeez
thegeez / spec_parsing.clj
Last active December 30, 2023 18:17
Parsing with clojure.spec for the Advent of Code challenge
(ns net.thegeez.advent.spec-parsing
(:require [clojure.string :as str]
[clojure.spec :as s]
[clojure.spec.gen :as gen]
[clojure.test.check.generators :as tgen]))
;; Dependencies:
;; [org.clojure/clojure "1.9.0-alpha14"]
;; [org.clojure/test.check "0.9.0"]
;; Advent of Code is a series of code challenges in the form of an advent
@rgl
rgl / wait_for_http_200.sh
Last active March 7, 2024 17:08
Wait for an HTTP endpoint to return 200 OK with Bash and curl
bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:9000)" != "200" ]]; do sleep 5; done'
# also check https://gist.github.com/rgl/c2ba64b7e2a5a04d1eb65983995dce76
@SkylerLipthay
SkylerLipthay / LICENSE.txt
Last active February 28, 2024 16:38
Prevent self-referential foreign key cycles in PostgreSQL
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
@zhenkyle
zhenkyle / Arch Linux mkinitcpio: Possibly missing firmware for module.md
Created May 6, 2016 03:15
Arch Linux mkinitcpio: Possibly missing firmware for module

Problem

In Arch Linux mkinitcpio -p linux

shows

Possibly missing firmware for module: aic94xx
 Possibly missing firmware for module: wd719x
@steinwaywhw
steinwaywhw / One Liner to Download the Latest Release from Github Repo.md
Last active May 3, 2024 15:54
One Liner to Download the Latest Release from Github Repo
  • Use curl to get the JSON response for the latest release
  • Use grep to find the line containing file URL
  • Use cut and tr to extract the URL
  • Use wget to download it
curl -s https://api.github.com/repos/jgm/pandoc/releases/latest \
| grep "browser_download_url.*deb" \
| cut -d : -f 2,3 \
| tr -d \" \
@jfpuget
jfpuget / Julia_Python_perf.ipynb
Last active April 15, 2022 11:55
An exercise in Python optimization: make Python benchmarks as fast, if not faster, than Julia.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jdfreder
jdfreder / nginx.conf
Created November 26, 2015 04:45
Simple nginx HTTP reverse proxy for JupyterHub on OSX
worker_processes 1;
events {
worker_connections 768;
}
http {
include mime.types;
default_type application/octet-stream;