Skip to content

Instantly share code, notes, and snippets.

View kchristidis's full-sized avatar
:bowtie:

Kostas Christidis kchristidis

:bowtie:
View GitHub Profile
@tekin
tekin / .gitattributes
Last active February 23, 2024 16:46
An example .gitattributes file that will configure custom hunk header patterns for some common languages and file formats. See https://tekin.co.uk/2020/10/better-git-diff-output-for-ruby-python-elixir-and-more for more details.
# Stick this in your home directory and point your Global Git config at it by running:
#
# $ git config --global core.attributesfile ~/.gitattributes
#
# See https://tekin.co.uk/2020/10/better-git-diff-output-for-ruby-python-elixir-and-more for more details
*.c diff=cpp
*.h diff=cpp
*.c++ diff=cpp
*.h++ diff=cpp
@lloydzhou
lloydzhou / redis-aggregate.lua
Last active October 9, 2020 05:53 — forked from Hidendra/redis-aggregate.lua
Aggregate values in a redis sorted set. Returns {count, sum, min, max}
local count = 0
local sum = 0
local min = 0
local max = 0
local cursor = "0"
local result = nil
local data = nil
repeat
result = redis.call("zscan", KEYS[1], cursor, "count", 100)
@derylspielman
derylspielman / RedisRetryTemplate.java
Last active January 29, 2024 07:31
Retryable Jedis connection for Redis that uses Spring's RetryTemplate.
package com.example.app.session;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.redis.core.RedisCallback;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.retry.RetryContext;
import org.springframework.retry.support.RetryTemplate;
/**
@kylemanna
kylemanna / price.txt
Created November 30, 2016 17:16
AWS Lightsail vs DigitalOcean, VULTR and Linode
Price breakdown vs DigitalOcean, Vultr and Linode:
RAM / CPU Cores / STORAGE / Transfer
$5/mo
LightSail: 512MB, 1, 20GB SSD, 1TB
DO: 512MB, 1, 20GB SSD, 1TB
VULTR: 768MB, 1, 15GB SSD, 1TB
$10/mo
@joepie91
joepie91 / blockchain.md
Last active June 25, 2023 08:40
Is my blockchain a blockchain?

Your blockchain must have all of the following properties:

  • It's a merkle tree, or a construct with equivalent properties.
  • There is no single point of trust or authority; nodes are operated by different parties.
  • Multiple 'forks' of the blockchain may exist - that is, nodes may disagree on what the full sequence of blocks looks like.
  • In the case of such a fork, there must exist a deterministic consensus algorithm of some sort to decide what the "real" blockchain looks like (ie. which fork is "correct").
  • The consensus algorithm must be executable with only the information contained in the blockchain (or its forks), and no external input (eg. no decisionmaking from a centralized 'trust node').

If your blockchain is missing any of the above properties, it is not a blockchain, it is just a ledger.

@apas
apas / ps1.sh
Last active November 6, 2016 04:31
minimal and elegant git aware shell prompt
# download jimeh's git-aware-prompt
# https://github.com/jimeh/git-aware-prompt
export GITAWAREPROMPT=~/.gap/git-aware-prompt
source $GITAWAREPROMPT/main.sh
# change your PS1 accordingly
# that'd normally print: `~ $`
# and in a git repo w/o changes: `/path/to/repo(branch-name) $`
# in git w/ changes: `/path/to/repo(branch-name)* $`
# (the asterisk is in red)

Mastering Programming - by Kent Beck

From years of watching master programmers, I have observed certain common patterns in their workflows. From years of coaching skilled journeyman programmers, I have observed the absence of those patterns. I have seen what a difference introducing the patterns can make. Here are ways effective programmers get the most out of their precious 3e9 seconds on the planet. The theme here is scaling your brain. The journeyman learns to solve bigger problems by solving more problems at once. The master learns to solve even bigger problems than that by solving fewer problems at once. Part of the wisdom is subdividing so that integrating the separate solutions will be a smaller problem than just solving them together.

Time

Slicing - Take a big project, cut it into thin slices, and rearrange the slices to suit your context. I can always slice projects finer and I can always find new permutations of the slices that meet different needs

@jhult
jhult / hide_linkedin_ads.txt
Last active November 7, 2021 21:05
Hide LinkedIn Ads - Adblock Filters
! Title: Hide LinkedIn Ads
! Last modified: 19 Sep 2019
! Expires: 20 days (update frequency)
! Homepage: https://gist.github.com/jhult/802e89c64c4b6f27a3a9
! Source: https://gist.githubusercontent.com/jhult/802e89c64c4b6f27a3a9/raw/hide_linkedin_ads.txt
! Licence: https://opensource.org/licenses/MIT
! Ad Banner
linkedin.com##.ad-banner-container
@phette23
phette23 / current-dir-in-iterm-tab-title.sh
Last active January 4, 2024 10:20
Set the iTerm tab title to the current directory, not full path.
# put this in your .bash_profile
if [ $ITERM_SESSION_ID ]; then
export PROMPT_COMMAND='echo -ne "\033];${PWD##*/}\007"; ':"$PROMPT_COMMAND";
fi
# Piece-by-Piece Explanation:
# the if condition makes sure we only screw with $PROMPT_COMMAND if we're in an iTerm environment
# iTerm happens to give each session a unique $ITERM_SESSION_ID we can use, $ITERM_PROFILE is an option too
# the $PROMPT_COMMAND environment variable is executed every time a command is run
# see: ss64.com/bash/syntax-prompt.html
@vderyagin
vderyagin / qsort.go
Created November 28, 2012 13:38
quick sort implementation in Golang
package qsort
import "math/rand"
func QuickSort(slice []int) []int {
length := len(slice)
if length <= 1 {
sliceCopy := make([]int, length)
copy(sliceCopy, slice)