Skip to content

Instantly share code, notes, and snippets.

View neumachen's full-sized avatar
🏠
Working from home

Kareem H neumachen

🏠
Working from home
  • Bergen, Norway
  • 06:37 (UTC -12:00)
View GitHub Profile
@dan-osull
dan-osull / fastapi_postgres_async_example.py
Created October 28, 2022 19:04
Async PostgreSQL with FastAPI dependency injection & SQLAlchemy
import os
from abc import ABC, abstractmethod
from typing import AsyncIterator, Optional
import uvicorn
from dotenv import load_dotenv
from fastapi import Depends, FastAPI
from fastapi.responses import JSONResponse
from sqlalchemy import select
from sqlalchemy.ext.asyncio import AsyncSession, create_async_engine
@anton-yurchenko
anton-yurchenko / golang-generic-struct.md
Created April 16, 2022 08:14
GoLang Generic Struct

The following snippet contains an example for GoLang Generics for Structs:

package main

import "fmt"

// Structs definition
type ObjectOne struct {
	Name string      `json:"name"`
@neumachen
neumachen / gist:fb30a03ff9e9c9fa9d9aed7711cd72ec
Created March 23, 2022 22:52 — forked from junegunn/gist:f4fca918e937e6bf5bad
Browsing git commit history with fzf
# fshow - git commit browser (enter for show, ctrl-d for diff, ` toggles sort)
fshow() {
local out shas sha q k
while out=$(
git log --graph --color=always \
--format="%C(auto)%h%d %s %C(black)%C(bold)%cr" "$@" |
fzf --ansi --multi --no-sort --reverse --query="$q" \
--print-query --expect=ctrl-d --toggle-sort=\`); do
q=$(head -1 <<< "$out")
k=$(head -2 <<< "$out" | tail -1)
@mikilian
mikilian / CMakeLists.txt
Created June 29, 2021 21:27
Modern C++ development with alpine linux, cmake, clang inside a docker container
set(CMAKE_C_COMPILER clang)
set(CMAKE_CXX_COMPILER clang++)
cmake_minimum_required(VERSION 3.18)
set(APP_NAME "example-app")
project("${APP_NAME}")
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -std=c++20 -Wno-multichar")
@lbiaggi
lbiaggi / ltex.lua
Last active October 20, 2023 19:27
ltex-ls support WIP
--- BEFORE USING, change language entries to fit your needs.
local lspconfig = require'lspconfig'
local configs = require'lspconfig/configs'
local util = require 'lspconfig/util'
local Dictionary_file = {
["pt-BR"] = {vim.fn.getenv("NVIM_HOME") .. "spell/dictionary.txt"} -- there is another way to find ~/.config/nvim ?
}
local DisabledRules_file = {
@hopsoft
hopsoft / Dockerfile
Last active May 17, 2023 19:58
Dockerize your Rails app
FROM ruby:3.0-alpine
RUN apk add --no-cache --update \
ack \
bash \
build-base \
curl \
git \
htop \
less \
@storeman
storeman / motion_illuminance_activated_entity.yaml
Last active June 17, 2023 20:30 — forked from freakshock88/motion_illuminance_activated_entity.yaml
Home Assistant BluePrint to turn on light, switch, scene or script based on motion and illuminance
blueprint:
name: Turn on light, switch, scene, script or group based on motion and illuminance.
description: >
Turn on a light, switch, scene, script or group based on motion detection, and low light level.
This blueprint uses helper entities you have to create yourself for some input values, to be able to dynamically set limits.
For instructions on creating the helper entities take a look in the Home Assistant Community forum topic:
https://community.home-assistant.io/t/turn-on-light-switch-scene-or-script-based-on-motion-and-illuminance-more-conditions/257085
@nikoheikkila
nikoheikkila / README.md
Last active April 15, 2024 17:15
Fish Shell function for sourcing standard .env files

envsource

⚠️ NOTE (20.5.2023): I don't really use this function at all anymore since there are now tools such as Taskfile, which reads the .env file for me sparing me the need to pollute my session with environment variables.


I've been using Fish shell for years which is great and all, but one thing that has got me frustrated is using it with .env files.

When attempting to run source .env in a project, I usually encounter this problem:

@maratori
maratori / .golangci.yml
Last active April 22, 2024 15:47
Golden config for golangci-lint
# This code is licensed under the terms of the MIT license https://opensource.org/license/mit
# Copyright (c) 2021 Marat Reymers
## Golden config for golangci-lint v1.57.2
#
# This is the best config for golangci-lint based on my experience and opinion.
# It is very strict, but not extremely strict.
# Feel free to adapt and change it for your needs.
run:
@yokeshrana
yokeshrana / vim-enhanced
Last active December 13, 2023 09:14
Customising vim for Mac OS (Big Sur)
1 :: Install Latest Cmake (Using the office dmg )
https://cmake.org/download/
Configure the paths for the cmake using the below command
sudo "/Applications/CMake.app/Contents/bin/cmake-gui" --install
2 :: Default mac os vim lacks python3 support and many other features ,so we will be compiling vim with full features(can limit if u want)
Verify first if Xcode developers tools are installed or not ,if not this will install it in mac
xcode-select --install
Now lets just move on to compiling vim from source on our distribution.
mkdir -p .vim/src