Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View bw2012's full-sized avatar
🐈
Coding for food

Konstantin Ivanov bw2012

🐈
Coding for food
View GitHub Profile
@bw2012
bw2012 / .gitconfig
Created February 9, 2017 20:22
Pretty git branch graphs
# http://stackoverflow.com/questions/1057564/pretty-git-branch-graphs
# vim ~/.gitconfig
[alias]
lg1 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all
lg2 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all
lg = !"git lg1"
@bw2012
bw2012 / list.cpp
Created July 11, 2018 20:49
lock free test
#include <stdio.h>
#include <atomic>
template<typename V>
class LockFreeList {
struct Node {
V value;
std::shared_ptr<Node> next;
Node(const V& value) : value(value), next(nullptr) {}
};
@bw2012
bw2012 / fuzzy_string_distance.cpp
Last active October 12, 2018 08:59
fuzzy substring
// ==========================================================
template <typename T>
typename T::value_type levenshtein_distance(const T& src, const T& dst) {
const typename T::size_type m = src.size();
const typename T::size_type n = dst.size();
if (m == 0) {
return n;
}
@bw2012
bw2012 / devices.c
Last active January 30, 2019 15:01 — forked from courtneyfaulkner/devices.c
List OpenCL platforms and devices
#include <stdio.h>
#include <stdlib.h>
#ifdef __APPLE__
#include <OpenCL/opencl.h>
#else
#include <CL/cl.h>
#endif
int main() {
@bw2012
bw2012 / Makefile
Created February 5, 2019 21:50
LD_PRELOAD
all:
gcc -shared -fPIC inspect.c -o inspect.so -ldl
@bw2012
bw2012 / kvdb_example.cpp
Last active February 20, 2019 15:02
kvdb example
#include "kvdb.h"
#include <cstring>
typedef struct TestStr {
int id = 0;
}TestStr;
int main() {
std::string fileName = "d://test_storage.dat";
@bw2012
bw2012 / gist:e7acfec738825b7e1683743d6fbfbce3
Created April 11, 2019 18:20
git squash branch to one commit
git checkout master
git merge --squash [branch]
git add .
git commit
@bw2012
bw2012 / gist:8132267969a8c4abbf99915a8d562c49
Created February 20, 2020 15:45
VirtualBox changing screen resolution of Mac OS guest
VBoxManage setextradata "High Sierra" VBoxInternal2/EfiGraphicsResolution 1920x1080
@bw2012
bw2012 / .gitconfig
Created March 15, 2020 19:22
git lg
[alias]
lg1 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all
lg2 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all
lg = !"git lg1"
push di
push si
push cx
mov cx,(number of bytes to move)
lea di,(destination address)
lea si,(source address)
rep movsb
pop cx
pop si
pop di