Skip to content

Instantly share code, notes, and snippets.

View valo's full-sized avatar
👷‍♂️
buidling

Valentin Mihov valo

👷‍♂️
buidling
View GitHub Profile
@valo
valo / gist:8371134
Created January 11, 2014 13:50
public key
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDIGoQM+/A5WC2j2cLvmY5cIP5bIhSFqU8AmfFmy0XtmLRzWupbk7z5BtUvYzY5X4nrB8leNnb6cFM2SgwHgQrV25Sd0YLrb4KcXxJcr45CanHWqXCBJlUwUAcWPYMjC743DXquKFypdctQOJJQfmqZmWuieaVIXNxPUB0a8LUfTE+K4M1/CHpQABm0wa4FQZ5VQrRwWyGbwK+dDB3djiYaoZetRNpRmjy70uRNP6imf5dmzUp0vDy94dWjSd+Y1ZcecZofCoUCoKnVZOZ7sGPOscy8cM7e7wZji7CltoTqeYzVEu8O7/Iej8XEfleaffFD+FAz/s/dBNHqf6lGjBc9 valentin@Valentins-MacBook-Air.local
$ ab -c 10 -n 100 http://178.62.172.238/rankings_practice
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 178.62.172.238 (be patient).....done
Server Software: nginx/1.4.6
@valo
valo / README.md
Last active May 30, 2018 06:59 — forked from skanev/README.md

Hacky syntax highlighting in git diff

Normally git diff would color additions green and deletions red. This is cool, but it would be even cooler if it adds syntax highlighting to those lines. This is a git pager that does so.

It parses the diff output and picks up the SHAs of files with additions and deletions. It uses [CodeRay][coderay] to highlight each file and then it extracts the lines that are shown in the diff. It then uses [term/ansicolor][color] to make a gradient from the CodeRay color and the diff color (red for deletion, green for addition) and uses it to replace the original.

I tried using rugged instead of shelling out to git show – it was faster overall, but it did incur a noticeable start up time.

Check out the image below for a demo.

@valo
valo / README.md
Last active August 29, 2015 14:07

Extracting the bar calculation into a separate object, which doesn't know about Foo, allows us to test this code in more isolation and to easily change it in the future, because of its reduced context.

Keybase proof

I hereby claim:

  • I am valo on github.
  • I am valo (https://keybase.io/valo) on keybase.
  • I have a public key whose fingerprint is 2C5B D381 351D 02B7 E0EF 002D 0E81 39C9 3B22 1782

To claim this, I am signing this object:

@valo
valo / cpuinfo
Created November 11, 2015 08:31
Grader specs
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 23
model name : Pentium(R) Dual-Core CPU E5300 @ 2.60GHz
stepping : 10
microcode : 0xa07
cpu MHz : 1200.000
cache size : 2048 KB
physical id : 0
@valo
valo / atoi_example.c
Created December 13, 2015 20:20
digits_to_number
#include <stdio.h>
int sample_input[] = {1,6,4, 10};
int loc = 0;
int getnumber() {
return sample_input[loc++];
}
int main() {
@valo
valo / pre-commit
Created February 8, 2016 12:57
Git hook: protect the master branch from pushing to it
#!/bin/bash
protected_branch='master'
current_branch=$(git symbolic-ref --short HEAD)
if [ $protected_branch = $current_branch ]
then
@valo
valo / timezones.csv
Created May 15, 2017 20:46
List of timezones
ACDT Australian Central Daylight Savings Time +10:30
ACST Australian Central Standard Time +09:30
ACT Acre Time -05
ACT ASEAN Common Time +06:30 - +09
ADT Atlantic Daylight Time -03
AEDT Australian Eastern Daylight Savings Time +11
AEST Australian Eastern Standard Time +10
AFT Afghanistan Time +04:30
AKDT Alaska Daylight Time -08
AKST Alaska Standard Time -09
@valo
valo / cloud-config.yml
Created May 6, 2020 10:19
cloud-config.yml
#cloud-config
ssh_authorized_keys:
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDIGoQM+/A5WC2j2cLvmY5cIP5bIhSFqU8AmfFmy0XtmLRzWupbk7z5BtUvYzY5X4nrB8leNnb6cFM2SgwHgQrV25Sd0YLrb4KcXxJcr45CanHWqXCBJlUwUAcWPYMjC743DXquKFypdctQOJJQfmqZmWuieaVIXNxPUB0a8LUfTE+K4M1/CHpQABm0wa4FQZ5VQrRwWyGbwK+dDB3djiYaoZetRNpRmjy70uRNP6imf5dmzUp0vDy94dWjSd+Y1ZcecZofCoUCoKnVZOZ7sGPOscy8cM7e7wZji7CltoTqeYzVEu8O7/Iej8XEfleaffFD+FAz/s/dBNHqf6lGjBc9 valentin@Valentins-MacBook-Air.local