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
  • 02:57 (UTC -12:00)
View GitHub Profile
@ggandor
ggandor / fzy.lua
Created April 25, 2023 12:40
Minimal fzy integration for Neovim in ~100 lines (oldfiles, cmd history, buffers, jumplist, etc.)
-- https://github.com/jhawthorn/fzy/pull/116#issuecomment-538708329
local function fzy(a)
local saved_spk = vim.o.splitkeep
local src_winid = vim.fn.win_getid()
-- lines >= 3 is a hardcoded limit in fzy
local fzy_lines = (vim.v.count > 2 and vim.v.count) or 10
local tempfile = vim.fn.tempname()
local term_cmd = a.input .. ' | fzy -l' .. fzy_lines .. ' > ' .. tempfile
-- FIXME: terminal buffer shows in `:ls!` after exiting.
@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 August 26, 2024 11:49
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 September 1, 2024 08:55
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 September 19, 2024 17:02
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.61.0
#
# 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: