Skip to content

Instantly share code, notes, and snippets.

View ismaelhamed's full-sized avatar
🚀
lezduit

Ismael Hamed ismaelhamed

🚀
lezduit
  • Spain
  • 17:33 (UTC +02:00)
View GitHub Profile
@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 }
@kvnsmth
kvnsmth / example-subtree-usage.md
Last active March 24, 2025 17:21
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 [email protected]:AFNetworking/AFNetworking.git Vendor/AFNetworking

or something to that effect.

@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>
/// <summary>
/// Resolves instances using the structure map object factory.
/// </summary>
public class StructureMapInstanceProvider : IInstanceProvider
{
/// <summary>
/// The service type
/// </summary>
private readonly Type serviceType;
@jboner
jboner / latency.txt
Last active April 19, 2025 21:29
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
@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);
@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