Skip to content

Instantly share code, notes, and snippets.

View gavocanov's full-sized avatar

Paolo Gavocanov gavocanov

  • Infobip
  • Pula, Croatia
View GitHub Profile
@sidola
sidola / Config.java
Last active March 26, 2025 19:04
SPA / Spring wildcard resource serve - This is how you configure Spring Boot to work with for example react-router. It will serve the `index.html` file on all routes that aren't used by REST controllers.
import java.io.IOException;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.springframework.web.servlet.resource.PathResourceResolver;
@Configuration
public class Config implements WebMvcConfigurer {
@i-am-tom
i-am-tom / FizzBuzz.hs
Last active December 21, 2024 10:17
Arguably the fastest implementation of FizzBuzz ever written.
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE UnsaturatedTypeFamilies #-}
import GHC.TypeLits
import Prelude hiding (Functor, Semigroup)
type Main = (Fizz <> Buzz) <$> (0 `To` 100)
@ekmett
ekmett / CEK.hs
Created July 22, 2018 17:53
A more strongly typed CEK machine
{-# Language StrictData #-}
{-# Language GADTs #-}
{-# Language DeriveTraversable #-}
{-# Language LambdaCase #-}
module CEK where
import Control.Monad (ap)
import Data.Maybe
import Data.Void
@ekmett
ekmett / CEK.hs
Created July 22, 2018 17:52
Simple CEK Machine
{-# language StrictData #-}
module CEK where
-- C -- Control
-- E -- Environment
-- (S) -- Store
-- K -- Continuation
data Exp
= Var String
@tom-seddon
tom-seddon / ido-goto-symbol.el
Last active June 30, 2018 10:38
ido/imenu mashup.
;; Interactively invoke ido-goto-symbol in a buffer that imenu understands.
(defun tom/get-imenu-alist ()
;; clean up old imenu data -- bit cheeky
(require 'imenu)
(imenu--menubar-select imenu--rescan-item)
(imenu--make-index-alist)
(let ((name-and-pos '()))
(cl-labels ((addsymbols (symbol-list)
(when (listp symbol-list)
@tom-seddon
tom-seddon / find-definition-of-elisp-symbol.el
Last active June 30, 2018 10:38
DWIM find-function kind of affair.
;; Interactively invoke tom/find-definition-of-elisp-symbol with point on an elisp symbol.
(defvar tom/find-definition-of-elisp-symbol-history '())
(defvar tom/find-definition-of-elisp-symbol-old-marker nil)
(defun tom/find-definition-of-elisp-symbol-add-marker ()
(when tom/find-definition-of-elisp-symbol-old-marker
(ring-insert find-tag-marker-ring tom/find-definition-of-elisp-symbol-old-marker)
(setq tom/find-definition-of-elisp-symbol-old-marker nil)))
@alexandrnikitin
alexandrnikitin / install-systemtap-on-centos-7.sh
Created August 11, 2017 14:06
Install systemtap on Centos 7
sudo yum install -y systemtap systemtap-runtime
sudo yum install kernel-debuginfo kernel-debuginfo-common
sudo yum install yum-utils
debuginfo-install kernel-3.10.0-514.21.2.el7.x86_64
sudo yum install -y kernel-devel-$(uname -r)
sudo yum install -y kernel-debuginfo-$(uname -r)
sudo yum install -y kernel-debuginfo-common-$(uname -m)-$(uname -r)
@kepbod
kepbod / iterm2-italics.sh
Last active October 1, 2023 13:28
use italics in iterm2
{ infocmp -1 xterm-256color ; echo "\tsitm=\\E[3m,\n\tritm=\\E[23m,"; } > /tmp/xterm-256color.terminfo
tic /tmp/xterm-256color.terminfo
" Add this to your vimrc to get a minimalist autocomplete pop
" Or use as a plugin : https://github.com/maxboisvert/vim-simple-complete
" Minimalist-TabComplete-Plugin
inoremap <expr> <Tab> TabComplete()
fun! TabComplete()
if getline('.')[col('.') - 2] =~ '\K' || pumvisible()
return "\<C-P>"
else
@adeekshith
adeekshith / .git-commit-template.txt
Last active October 20, 2024 21:10 — forked from Linell/.git-commit-template.txt
This commit message template helps you write great commit messages and enforce it across teams.
# <type>: (If applied, this commit will...) <subject> (Max 50 char)
# |<---- Using a Maximum Of 50 Characters ---->|
# Explain why this change is being made
# |<---- Try To Limit Each Line to a Maximum Of 72 Characters ---->|
# Provide links or keys to any relevant tickets, articles or other resources
# Example: Github issue #23