Skip to content

Instantly share code, notes, and snippets.

View AndreyAkinshin's full-sized avatar

Andrey Akinshin AndreyAkinshin

View GitHub Profile
@AndreyAkinshin
AndreyAkinshin / fips-download-template.py
Last active August 29, 2015 14:11
Template for fips bulletin downloading
# Main link: http://www1.fips.ru/wps/wcm/connect/content_ru/ru/ofic_pub/ofic_bul/ofic_bul_prevm
# pdf->txt converter: pdfminer, https://pypi.python.org/pypi/pdfminer/
import urllib, os
def get_link(year, month, number):
link = "http://www1.fips.ru/Archive/EVM/" + \
str(year) + "/" + str(year) + "." + str(month).zfill(2) + ".20" + \
"/DOC/RUNW/000/00" + str(year)[0:1] + "/" + str(year)[1:4].zfill(3) + "/" + \
str(number)[0:3].zfill(3) + "/" + str(number)[3:6].zfill(3) + "/document.pdf"
@AndreyAkinshin
AndreyAkinshin / JitVersionInfo.cs
Last active September 7, 2015 15:30
Determination JIT version in runtime
public enum JitVersion
{
Mono, MsX86, MsX64, RyuJit
}
public class JitVersionInfo
{
public JitVersion GetJitVersion()
{
if (IsMono())
@AndreyAkinshin
AndreyAkinshin / PrivateBaseClassConstructorInheritance.cs
Last active July 29, 2016 08:31
Create derived class for base class with private constructor
using System;
using System.Runtime.InteropServices;
class Program
{
public class Base
{
private Base()
{
}
@AndreyAkinshin
AndreyAkinshin / DEV Labs 2015 - Учимся замерять время правильно.md
Last active June 28, 2022 19:09
DEV Labs 2015 - Учимся замерять время правильно

Введение

  • Главный вопрос: что и зачем вы измеряете?
  • Используйте библиотеки для бенчмаркинга: JMH, BenchmarkDotNet

Как правильно запускать бенчмарк

  • Release build
  • Без дебаггера
  • Выключите другие приложения
[alias]
l = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=short
lg = log --graph --date-order --pretty=format:'%C(bold blue)%h%C(reset) %C(bold green)[%an]%C(reset) %Cgreen%d%Creset %s, %C(yellow)%ad%C(reset)' --date=iso
lgl = log --graph --date-order --pretty=format:'%C(bold blue)%h%C(reset) %C(bold green)[%an]%C(reset) %Cgreen%d%Creset %s, %C(yellow)%ad%C(reset)' --date=iso -10
a = add
ap = add -p
c = commit --verbose
ca = commit -a --verbose
cm = commit -m
@AndreyAkinshin
AndreyAkinshin / JitModules.cs
Created February 8, 2016 09:56
JitModules.cs
using System;
using System.Diagnostics;
using System.Linq;
public static class JitModules
{
public static void Main()
{
Console.WriteLine("OS: " + Environment.OSVersion.VersionString);
Console.WriteLine("CLR: " + Environment.Version);
################################################################################
# A simulation of the Elowitz's repressilator.
#
# References
# * A Synthetic Oscillatory Network of Transcriptional Regulators;
# Michael Elowitz and Stanislas Leibler; Nature. 2000 Jan 20;403(6767):335-8.
#
# Author: Andrey Akinshin
################################################################################
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
#SingleInstance force
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
SetCapsLockState, AlwaysOff
; Based on https://gist.github.com/ronjouch/2428558
; Variables definition
<Colors>
<Foreground>12303291</Foreground>
<Background>4276028</Background>
<Background2>4276028</Background2>
<Mark>33023</Mark>
<Cursor>11497035</Cursor>
<CursorText>-2147483634</CursorText>
<UseInvertedSelection>False</UseInvertedSelection>
<InactivePanelBrightness>100</InactivePanelBrightness>
<UseFrameCursor>False</UseFrameCursor>
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
namespace NuGetUltimateBuilder
{
// Requires nuget.exe >= v3.5.0-rc1
internal class Program