Skip to content

Instantly share code, notes, and snippets.

View prestancedesign's full-sized avatar

Michael Salihi prestancedesign

View GitHub Profile
@willurd
willurd / web-servers.md
Last active April 18, 2024 14:15
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@plentz
plentz / nginx.conf
Last active April 18, 2024 12:42
Best nginx configuration for improved security(and performance)
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@JamesMGreene
JamesMGreene / gitflow-breakdown.md
Last active April 16, 2024 16:36
`git flow` vs. `git`: A comparison of using `git flow` commands versus raw `git` commands.

Initialize

gitflow git
git flow init git init
  git commit --allow-empty -m "Initial commit"
  git checkout -b develop master

Connect to the remote repository

@yogthos
yogthos / clojure-beginner.md
Last active April 15, 2024 17:11
Clojure beginner resources

Introductory resources

/**
* Retrieves all the rows in the active spreadsheet that contain data and logs the
* values for each row.
* For more information on using the Spreadsheet API, see
* https://developers.google.com/apps-script/service_spreadsheet
*/
function readRows() {
var sheet = SpreadsheetApp.getActiveSheet();
var rows = sheet.getDataRange();
var numRows = rows.getNumRows();
@ipbastola
ipbastola / jq to filter by value.md
Last active April 12, 2024 05:36
JQ to filter JSON by value

JQ to filter JSON by value

Syntax: cat <filename> | jq -c '.[] | select( .<key> | contains("<value>"))'

Example: To get json record having _id equal 611

cat my.json | jq -c '.[] | select( ._id | contains(611))'

Remember: if JSON value has no double quotes (eg. for numeric) to do not supply in filter i.e. in contains(611)

@john2x
john2x / 00_destructuring.md
Last active April 10, 2024 19:12
Clojure Destructuring Tutorial and Cheat Sheet

Clojure Destructuring Tutorial and Cheat Sheet

(Related blog post)

Simply put, destructuring in Clojure is a way extract values from a datastructure and bind them to symbols, without having to explicitly traverse the datstructure. It allows for elegant and concise Clojure code.

Vectors and Sequences

@borkdude
borkdude / router.clj
Last active April 9, 2024 15:03
Small ring router using core.mach in babashka
(require '[clojure.core.match :refer [match]]
'[clojure.string :as str]
'[hiccup2.core :refer [html]]
'[org.httpkit.server :as server])
(defn router [req]
(let [paths (vec (rest (str/split (:uri req) #"/")))]
(match [(:request-method req) paths]
[:get ["users" id]] {:body (str (html [:div id]))}
:else {:body (str (html [:html "Welcome!"]))})))
@alphapapa
alphapapa / fitness.org
Last active April 6, 2024 04:33
An Emacs food/weight/workout tracker self-contained in a single Org file

Plots

/home/me/org/double-plot.png

Tasks