Skip to content

Instantly share code, notes, and snippets.

View kevthanewversi's full-sized avatar

Kevin Murimi kevthanewversi

View GitHub Profile
flaviocopes / check-substring-ends-with.go
Last active November 15, 2021 09:34
Go: check if a string ends with a substring #golang
package main
import (
func main() {
strings.HasSuffix("foobar", "bar") // true
xigang / sort_time.go
Created May 4, 2017 04:04
Sorting by time.Time in Golang
package main
import (
type reviews_data struct {
review_id string
valentin2105 /
Last active July 6, 2018 10:16
Manage a Ganeti Cluster
Add a VM in plain disk:
gnt-instance add plain --disk 0:size=20G --disk 1:size=200M \
-B memory=2G,vcpus=2 -o debootstrap+jessie --no-ip-check \ 
Add a VM in DRBD (fully-sharred between two servers) :
gnt-instance add drbd --disk 0:size=20G --disk 1:size=200M \
-B memory=2G,vcpus=2 -o debootstrap+jessie --no-ip-check \
vasanthk / System
Last active May 16, 2024 20:21
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">
kamermans /
Last active April 26, 2024 00:58
Change the IP subnet of Docker's docker0 interface
#!/bin/sh -e
# NOTE: Since Docker 1.10 (February 4, 2016), it has been possible to configure the
# Docker daemon using a JSON config file. On Linux, this file is normally located at
# /etc/docker/daemon.json. You should use this JSON config method if you are running
# a version of Docker that is at least 1.10!
# Here is an example configuration that sets the docker0 bridge IP to
# {
# "bip": ""
# }
sergiotapia / images_dimensions.go
Last active February 13, 2024 17:40
Golang - Getting the dimensions of an image. jpg, jpeg, png
package main
import (
_ "image/jpeg"
_ "image/png"
kachayev /
Last active April 14, 2024 06:58
Dijkstra shortest path algorithm based on python heapq heap implementation
from collections import defaultdict
from heapq import *
def dijkstra(edges, f, t):
g = defaultdict(list)
for l,r,c in edges:
q, seen, mins = [(0,f,())], set(), {f: 0}
while q:
pksunkara / config
Last active May 19, 2024 09:52
Sample of git config file (Example .gitconfig) (Place them in $XDG_CONFIG_HOME/git)
name = Pavan Kumar Sunkara
email =
username = pksunkara
defaultBranch = master
editor = nvim
whitespace = fix,-indent-with-non-tab,trailing-space,cr-at-eol
pager = delta
!function() {
var doc = document,
htm = doc.documentElement,
lct = null, // last click target
nearest = function(elm, tag) {
while (elm && elm.nodeName != tag) {
elm = elm.parentNode;
return elm;