Skip to content

Instantly share code, notes, and snippets.

@hxsf
hxsf / License
Last active April 21, 2022 07:22
Golang to snake_case
MIT License
Copyright (c) [2021] [hxsf]
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@vncsna
vncsna / bash_strict_mode.md
Created June 6, 2021 01:59 — forked from mohanpedala/bash_strict_mode.md
set -e, -u, -o, -x pipefail explanation

set -e, -u, -o, -x pipefail

The set lines

  • These lines deliberately cause your script to fail. Wait, what? Believe me, this is a good thing.
  • With these settings, certain common errors will cause the script to immediately fail, explicitly and loudly. Otherwise, you can get hidden bugs that are discovered only when they blow up in production.
  • set -euxo pipefail is short for:
set -e
set -u
@FZambia
FZambia / pool.go
Created September 10, 2019 14:39
Go language timer pool
package timers
import (
"sync"
"time"
)
var timerPool sync.Pool
// AcquireTimer from pool.
@asigatchov
asigatchov / docker-iptables.sh
Created April 12, 2019 10:08
docker iptables
#!/usr/bin/env bash
# Usage:
# timeout 10 docker_iptables.sh
#
# Use the builtin shell timeout utility to prevent infinite loop (see below)
if [ ! -x /usr/bin/docker ]; then
exit
fi
@mohanpedala
mohanpedala / bash_strict_mode.md
Last active June 20, 2024 03:04
set -e, -u, -o, -x pipefail explanation
@0xced
0xced / FromHeader.cs
Last active November 1, 2023 06:20
[FromHeader] parameter binding and attribute for ASP.NET Web API + Swashbuckle integration
using System;
using System.ComponentModel;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using System.Web.Http;
using System.Web.Http.Controllers;
using System.Web.Http.Metadata;
@rosswd
rosswd / books.md
Created April 2, 2017 21:42
Game Programming & Game Design

Game Programming & Game Design Books

  • Introduction to 3D Game Programming with DirectX 11 (Frank D. Luna)

  • Mathematics for 3D Game Programming and Computer Graphics (Eric Lengyel)

  • 3D Game Engine Programming (Stefan Zerbst, Oliver Duvel)

  • Black Art of 3D Game Programming: Writing Your Own High-Speed 3D Polygon Video Games in C (Andre LaMothe)

@GLMeece
GLMeece / latency_numbers.md
Last active May 22, 2024 15:57
Latency Numbers Every Programmer Should Know - MarkDown Fork

Latency Comparison Numbers

Note: "Forked" from Latency Numbers Every Programmer Should Know

Event Nanoseconds Microseconds Milliseconds Comparison
L1 cache reference 0.5 - - -
Branch mispredict 5.0 - - -
L2 cache reference 7.0 - - 14x L1 cache
Mutex lock/unlock 25.0 - - -
@FZambia
FZambia / timer.go
Created January 6, 2017 18:48
Timer pool for Go language
package pools
import (
"sync"
"time"
)
var timerPool sync.Pool
// AcquireTimer returns time from pool if possible.
@rambabusaravanan
rambabusaravanan / .gitconfig
Last active May 30, 2024 06:08
Git Diff and Merge Tool - IntelliJ IDEA
# Linux
# add the following to "~/.gitconfig" file
[merge]
tool = intellij
[mergetool "intellij"]
cmd = /usr/local/bin/idea merge $(cd $(dirname "$LOCAL") && pwd)/$(basename "$LOCAL") $(cd $(dirname "$REMOTE") && pwd)/$(basename "$REMOTE") $(cd $(dirname "$BASE") && pwd)/$(basename "$BASE") $(cd $(dirname "$MERGED") && pwd)/$(basename "$MERGED")
trustExitCode = true
[diff]