Skip to content

Instantly share code, notes, and snippets.

View dodbrian's full-sized avatar

Denis Zimin dodbrian

  • COMPLEVO GmbH
  • Berlin, Germany
View GitHub Profile
@dodbrian
dodbrian / python3-install.md
Last active May 13, 2019 15:57
Python 3 installation steps

Python 3 installation steps

Install pyenv

curl https://pyenv.run | bash

Install dependencies

sudo apt install build-essential zlib1g-dev libffi-dev libssl-dev

Install Python

pyenv install 3.7.3

@dodbrian
dodbrian / js-array-vs-set.js
Created April 8, 2019 20:49
Benchmarking JavaScript Arrays and Sets
let arr = [], set = new Set(), n = 1000000;
for (let i = 0; i < n; i++) {
arr.push(i);
set.add(i);
}
function checkArr(arr, value) {
return arr.indexOf(value);
}
@dodbrian
dodbrian / rm-kernels.sh
Last active March 14, 2021 19:07
Bash script to remove old kernels
#!/bin/bash
# NAME: rm-kernels
# PATH: /usr/local/bin
# DESC: Provide zenity item list of kernels to remove
# DATE: Mar 10, 2017. Modified Aug 5, 2017.
# NOTE: Will not delete current kernel.
@dodbrian
dodbrian / docker-compose.yml
Last active February 15, 2019 18:22
Gitlab Docker
web:
image: 'gitlab/gitlab-ce:latest'
container_name: gitlab
restart: always
hostname: 'localhost'
environment:
GITLAB_OMNIBUS_CONFIG: |
external_url 'http://localhost:32700'
# Add any other gitlab.rb configuration here, each on its own line
ports:
@dodbrian
dodbrian / git-commands.md
Last active November 19, 2020 10:31
Useful git commands

Useful Git Commands

undo last rebase

  1. Run git reflog and find first line from the top without rebase:
  2. Take that line number, for instance: HEAD@{5}
  3. Run git reset --hard HEAD@{5} to revert to the original state

undo last commit/merge

git reset --hard HEAD~1

@dodbrian
dodbrian / String2Lambda.cs
Last active February 2, 2018 09:34
Convert string column name into property accessor
public Expression<Func<TEntity, TProperty>> ColumnByName<TEntity, TProperty>(string columnName)
{
var propInfo = typeof(TEntity).GetProperty(columnName);
var parameter = Expression.Parameter(typeof(TEntity));
var memberAccess = Expression.MakeMemberAccess(parameter, propInfo);
var exp = Expression.Lambda<Func<TEntity, TProperty>>(memberAccess, parameter);
return exp;
}
@dodbrian
dodbrian / Program.cs
Created December 5, 2015 10:46
Using .xlsx file as a report template
using System;
using System.IO;
using System.Linq;
using OfficeOpenXml;
using SpreadsheetLight;
namespace XlsxTemplateTest
{
internal static class Program
{