Skip to content

Instantly share code, notes, and snippets.

@somahargitai
somahargitai / goExecutableHowto.MD
Last active September 22, 2021 17:32
Make Go executable work on Mac

Make Go executable work on Mac

What we do

  • add necessary folder to Path
  • get the repo
  • create executable file with Make
  • copy executable to /usr/local/bin to let us it everwhere
  • modify access with chmod
@aiotter
aiotter / grep
Last active July 4, 2022 23:58
better grep (silently use ripgrep if available)
#!/usr/bin/env python3
# Copyright 2021 aiotter
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH T
@rsperl
rsperl / run_docker_container.py
Last active July 25, 2022 13:11
Run a docker container from python #docker #container #python #snippet
#!/usr/bin/env python3
import docker
import os
import sys
import base64
image = "registry.com/me/image:1.2.3"
CWD = os.path.abspath(os.path.dirname(__file__))
# DOCKER_HOST=unix://var/run/docker.sock
@pupattan
pupattan / docker-image-pull-using-python-sdk.py
Last active October 19, 2021 23:47
How to pull docker image using python
# Install docker mdule using pip. Refer https://docker-py.readthedocs.io/en/stable/
import docker
DOCKER_USERNAME = "" # Provide your docker username
DOCKER_EMAIL = "" # Provide your docker email
DOCKER_PASSWORD = "" # Provide your docker password
DOCKER_IMAGE = "nginxproxy/nginx-proxy:latest" # Provide your docker image with tag
def image_pull():
@jgarte
jgarte / main.scm
Created August 13, 2021 08:27 — forked from theodesp/main.scm
Simple main executable scheme #scheme
#!/usr/local/bin/guile \
-e main -s
!#
(define (main args)
;; Usage ./main.scm a b c
(map (lambda (arg) (display arg) (display " "))
(cdr args))
(newline))
;; How to run
;; sbcl --load download-peertube-videos.lisp
(ql:quickload :jonathan)
(ql:quickload :dexador)
(ql:quickload :alexandria)
(ql:quickload :asdf)
(import 'alexandria:assoc-value)
@CyrilBvt13
CyrilBvt13 / db.py
Created June 2, 2021 07:20
FlaskAPI Basic - db.py
from tinydb import TinyDB, Query
db = TinyDB('flaskAPI.json')
query = Query()
@bitsmanent
bitsmanent / dtree.js
Last active November 30, 2021 18:07
Extremely simple decision tree implementation
function dtree_decide(tree, ...argv) {
var i, len, r;
for(i = 0, len = tree.length; i < len; i++)
if((r = tree[i](...argv)))
return r;
return false;
}
function dtree_make(tree) {
@hanslovsky
hanslovsky / find-duplicates.py
Last active July 5, 2022 00:03
Find duplicates in jars
#!/usr/bin/env python3.9
from functools import reduce
from pathlib import Path
from subprocess import check_output
import re
m2_repo = Path.home() / '.m2' / 'repository'

The Why and When of Choosing Elm

What is Elm?

  • Language (and "framework") for building web frontend applications
  • Can be used in place of HTML, CSS and JavaScript
  • Compiles into the above