Skip to content

Instantly share code, notes, and snippets.

View hazzik's full-sized avatar

Alex Zaytsev hazzik

  • Brisbane, Australia
View GitHub Profile
@hazzik
hazzik / mount_ntfs_3g.plist
Last active February 6, 2022 00:27 — forked from zhylmzr/mount_ntfs_3g.plist
automount all ntfs volume writable in macOS Big Sur+
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>mount_ntfs_3g</string>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<false/>
using System;
using System.Linq.Expressions;
using System.Reflection;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
namespace FastGetMethodBenchmark
{
public class FastGetMethodVsGetMethod
{
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using NUnit.Framework;
public class CachingEnumerable<T> : IEnumerable<T>, IDisposable
{
List<T> _cache;
@hazzik
hazzik / ex1.cs
Last active August 29, 2015 14:27
NHibernateQuery
interface IQuery<TCriteria, TResult> { TResult Execute(TCriteria criteria); }
class BooksWithISBN { public string ISBN { get; set; } }
class BooksWithISBNQuery : IQuery<BooksWithISBN, IEnumerable<Book>> {
public IEnumerable<Book> Execute(BooksWithISBN criteria) {
return session.Query<Book>().Where(b => b.ISBN == criteria.ISBN).AsEnumerable();
}
}
$file = Get-Content ".\bower.json"
$component = "$file" | ConvertFrom-Json
$jquery = $component.dependencies.jquery.replace('>=', '')
echo "<?xml version=""1.0""?>
<package xmlns=""http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"">
<metadata>
<version>$($component.version).$env:BUILD_NUMBER</version>
<authors>Chris Wanstrath, Joshua Peek</authors>
<owners>hazzik</owners>
<licenseUrl>https://github.com/defunkt/jquery-pjax/blob/master/LICENSE</licenseUrl>
using System;
using System.Net;
using System.Net.Sockets;
using System.Threading;
class Program
{
static void Main()
{
for (int i = 0; i < 1000; i++)
#! /bin/bash
# Assumes that you tag versions with the version number (e.g., "1.1")
# and then the build number is that plus the number of commits since
# the tag (e.g., "1.1.17")
DESCRIBE=`git describe --tags --always`
# increment the build number (ie 115 to 116)
VERSION=`echo $DESCRIBE | awk '{split($0,a,"-"); print a[1]}'`
# BlogML import script originally sourced from:
# https://github.com/philippkueng/philippkueng.github.com/tree/30ef1570f06d33938b18d5eee7767d6641b9a779/source/_import
# Best post I could find about how to use it was here:
# http://philippkueng.ch/migrate-from-blogengine-dot-net-to-jekyll.html
#
# how to install
# --------------
# mkdir source/_importer
# cp blogml.rb to the source/_importer/ you created above
# cp your BlogML.xml to the same source/_importer/ directory
[alias]
co = checkout
ec = config --global -e
up = !git pull --rebase --prune $@ && git submodule update --init --recursive
cob = checkout -b
cm = !git add -A && git commit -m
save = !git add -A && git commit -m 'SAVEPOINT'
wip = !git add -u && git commit -m "WIP"
undo = reset HEAD~1 --mixed
amend = commit -a --amend
@hazzik
hazzik / RestClient.cs
Created August 26, 2014 23:07
Simple dynamic REST client
public class RestClient : DynamicObject
{
private readonly string _address;
public RestClient(string address)
{
this._address = address;
}
public override bool TryInvokeMember(InvokeMemberBinder binder, object[] args, out object result)