Skip to content

Instantly share code, notes, and snippets.

View ismaelhamed's full-sized avatar
🚀
lezduit

Ismael Hamed ismaelhamed

🚀
lezduit
  • Schneider Electric
  • Spain
  • 04:26 (UTC +02:00)
View GitHub Profile
@seanparsons
seanparsons / gist:964759
Created May 10, 2011 16:02
Akka ASCII art!
05/10 17:01:35 INFO [main] a.s.AkkaLoader - ==================================================
05/10 17:01:35 INFO [main] a.s.AkkaLoader - t
05/10 17:01:35 INFO [main] a.s.AkkaLoader - t t t
05/10 17:01:35 INFO [main] a.s.AkkaLoader - t t tt t
05/10 17:01:35 INFO [main] a.s.AkkaLoader - tt t t tt t
05/10 17:01:35 INFO [main] a.s.AkkaLoader - t ttttttt t ttt t
05/10 17:01:35 INFO [main] a.s.AkkaLoader - t tt ttt t ttt t
05/10 17:01:35 INFO [main] a.s.AkkaLoader - t t ttt t ttt t t
05/10 17:01:35 INFO [main] a.s.AkkaLoader - tt t ttt ttt ttt t
05/10 17:01:35 INFO [main] a.s.AkkaLoader - t t ttt ttt t tt t
@kristopherjohnson
kristopherjohnson / PrettyXml.cs
Created December 4, 2011 18:52
Example of pretty-printing XML in C# using the XmlWriter class
using System;
using System.Text;
using System.Xml;
using System.Xml.Linq;
static string PrettyXml(string xml)
{
var stringBuilder = new StringBuilder();
var element = XElement.Parse(xml);
@jboner
jboner / latency.txt
Last active July 7, 2024 21:35
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
/// <summary>
/// Resolves instances using the structure map object factory.
/// </summary>
public class StructureMapInstanceProvider : IInstanceProvider
{
/// <summary>
/// The service type
/// </summary>
private readonly Type serviceType;
@mfcollins3
mfcollins3 / GenerateVersionInfo.xml
Created January 24, 2013 16:44
Classes for using semantic version numbers with .NET applications. For more information, see <http://www.michaelfcollins3.me/blog/2013/01/23/semantic_versioning_dotnet.html>.
<!--
The GenerateVersionInfo task will generate the VersionInfo.cs file with the
metadata for the current build.
-->
<UsingTask TaskName="GenerateVersionInfo"
TaskFactory="CodeTaskFactory"
AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
<ParameterGroup>
@kvnsmth
kvnsmth / example-subtree-usage.md
Last active March 5, 2023 21:58
A real world usage for git subtrees.

Let's say you have an iOS project, and you want to use some external library, like AFNetworking. How do you integrate it?

With submodules

Add the project to your repo:

git submodule add git@github.com:AFNetworking/AFNetworking.git Vendor/AFNetworking

or something to that effect.

@patriknw
patriknw / LoggingMailbox.scala
Last active January 5, 2023 08:12
Logs the mailbox size when exceeding the configured limit. Implemented in Scala and Java. Copy one of them to your project and define the configuration. This code is licensed under the Apache 2 license.
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.contrib.mailbox
import scala.concurrent.duration._
import java.util.concurrent.atomic.AtomicInteger
import java.util.concurrent.atomic.AtomicLong
import com.typesafe.config.Config
import akka.actor.{ ActorContext, ActorRef, ActorSystem, ExtendedActorSystem }
@grenade
grenade / NServiceBusServiceDeployConfig.ps1
Last active December 29, 2015 13:28
Install an NServiceBus dependent Windows Service using PowerShell DSC Note that this is an untested work in progress. It wont work out of the box. ...yet.
Configuration NServiceBusServiceDeployConfig {
param (
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[string[]] $targetNodes,
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[string] $serviceDeployPath,
@mobilemind
mobilemind / git-tag-delete-local-and-remote.sh
Last active July 2, 2024 00:02
how to delete a git tag locally and remote
# delete local tag '12345'
git tag -d 12345
# delete remote tag '12345' (eg, GitHub version too)
git push origin :refs/tags/12345
# alternative approach
git push --delete origin tagName
git tag -d tagName
@archie
archie / ParentChild.scala
Created December 13, 2013 22:42
Examples of testing Akka actor parent-child relationships, mostly based on findings from https://www.assembla.com/spaces/akka/tickets/3043#/activity/ticket:
package pc
import akka.actor.Actor
import akka.actor.Props
import akka.actor.ActorRef
import akka.actor.ActorRefFactory
class Parent extends Actor {
val child = context.actorOf(Props[Child], "child")
var ponged = false