Skip to content

Instantly share code, notes, and snippets.

@lonnen
lonnen / gist:3101795
Created July 12, 2012 23:24
git grep and git blame. two great tastes that taste great together
# from i8ramin - http://getintothis.com/blog/2012/04/02/git-grep-and-blame-bash-function/
# runs git grep on a pattern, and then uses git blame to who did it
ggb() {
git grep -n $1 | while IFS=: read i j k; do git blame -L $j,$j $i | cat; done
}
# small modification for git egrep bash
geb() {
git grep -E -n $1 | while IFS=: read i j k; do git blame -L $j,$j $i | cat; done
}
@rasmuskl
rasmuskl / fnv64a1.cs
Created September 26, 2012 07:39
FNV 1a 64-bit C# non-cryptographic hash
// FNV-1a (64-bit) non-cryptographic hash function.
// Adapted from: http://github.com/jakedouglas/fnv-java
public ulong HashFNV1a(byte[] bytes)
{
const ulong fnv64Offset = 14695981039346656037;
const ulong fnv64Prime = 0x100000001b3;
ulong hash = fnv64Offset;
for (var i = 0; i < bytes.Length; i++)
{
@dbuscombe-usgs
dbuscombe-usgs / fix
Created July 26, 2013 02:57
Batch GIMP script for auto-sharpen, white-balance and colour enhance
(define (batch-auto-fix pattern
radius
amount
threshold)
(let* ((filelist (cadr (file-glob pattern 1))))
(while (not (null? filelist))
(let* ((filename (car filelist))
(image (car (gimp-file-load RUN-NONINTERACTIVE
filename filename)))
(drawable (car (gimp-image-get-active-layer image))))
@denji
denji / nginx-tuning.md
Last active June 21, 2024 15:08
NGINX tuning for best performance

Moved to git repository: https://github.com/denji/nginx-tuning

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.

@mark-adams
mark-adams / aes_example.cs
Created December 12, 2014 15:02
AES String Encryption (CBC) Example Code for C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
namespace aes_example
{
using System;
@evanwill
evanwill / gitBash_windows.md
Last active May 29, 2024 11:03
how to add more utilities to git bash for windows, wget, make

How to add more to Git Bash on Windows

Git for Windows comes bundled with the "Git Bash" terminal which is incredibly handy for unix-like commands on a windows machine. It is missing a few standard linux utilities, but it is easy to add ones that have a windows binary available.

The basic idea is that C:\Program Files\Git\mingw64\ is your / directory according to Git Bash (note: depending on how you installed it, the directory might be different. from the start menu, right click on the Git Bash icon and open file location. It might be something like C:\Users\name\AppData\Local\Programs\Git, the mingw64 in this directory is your root. Find it by using pwd -W). If you go to that directory, you will find the typical linux root folder structure (bin, etc, lib and so on).

If you are missing a utility, such as wget, track down a binary for windows and copy the files to the corresponding directories. Sometimes the windows binary have funny prefixes, so

@lesha-co
lesha-co / ascii_box.txt
Last active March 22, 2023 15:45
Палитра для рисования ASCII
Таблицы
Обычная Жирная Двойная
┌─┬─┐ ┏━┳━┓ ╔═╦═╗
├─┼─┤ ┣━╋━┫ ╠═╬═╣
│ │ │ ┃ ┃ ┃ ║ ║ ║
└─┴─┘ ┗━┻━┛ ╚═╩═╝
Частично двойные и жирные
╓╥╖ ╒╤╕ ┎┰┒ ┍┯┑
╟╫╢ ╞╪╡ ┠╂┨ ┝┿┥
╙╨╜ ╘╧╛ ┖┸┚ ┕┷┙
@jmrnilsson
jmrnilsson / 32and64bit.cs
Last active May 9, 2020 05:43
Fowler–Noll–Vo 1 A (FNV1) in 32 bit and 64 bit variants
using System;
using System.Text;
namespace Hashing
{
public static class FowlerNollVo
{
public static string ToFnv1aHashInt64(this string text)
{
string Fnv1a(byte[] bytes_)
#include "ArduinoMotorShieldR3.h"
// https://store.arduino.cc/arduino-motor-shield-rev3
// https://randomnerdtutorials.com/complete-guide-for-ultrasonic-sensor-hc-sr04/
// https://github.com/gallingern/arduino-motor-shield-r3
ArduinoMotorShieldR3 md;
int trigPin = 5; // Trigger
int echoPin = 4; // Echo
int ledPin = 7;
@tamalsaha
tamalsaha / issuer.yaml
Last active March 3, 2023 19:37
Redis TLS with KubeDB
apiVersion: cert-manager.io/v1
kind: Issuer
metadata:
name: redis-issuer
namespace: demo
spec:
ca:
secretName: redis-ca