Skip to content

Instantly share code, notes, and snippets.

@mnadel
mnadel / gist:6170771
Created August 7, 2013 02:49
List of offline uDeploy agents
curl -s -u "PasswordIsAuthToken:{\"token\":\"$UD_AUTH_TOKEN\"}" $UD_SERVER/rest/agent/all \
| jq '.[] | {name} | select(.status != "ONLINE")' \
| grep name \
| awk 'BEGIN { FS = "\"" } { print $4 }'
@mnadel
mnadel / tomcat.sh
Last active January 1, 2016 06:09 — forked from valotas/tomcat.sh
#!/bin/bash
#
# tomcat7 This shell script takes care of starting and stopping Tomcat
#
# chkconfig: - 80 20
#
### BEGIN INIT INFO
# Provides: tomcat
# Required-Start: $network $syslog
# Required-Stop: $network $syslog
@mnadel
mnadel / go-oci8 on win64.md
Last active December 26, 2022 12:06
go-oci8 on windows64
@mnadel
mnadel / RequestHandler.java
Created February 22, 2014 18:32
Netty HTTP Server
import io.netty.buffer.Unpooled;
import io.netty.channel.ChannelFutureListener;
import io.netty.channel.ChannelHandlerAdapter;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
import io.netty.handler.codec.http.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.nio.charset.Charset;
@mnadel
mnadel / DatabaseCallable.java
Last active May 18, 2018 13:43
Dropwizard + Hystrix + Hibernate
import org.apache.commons.lang3.Validate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.concurrent.Callable;
/**
* A database session and transaction-aware Callable
*/
class DatabaseCallable<T> implements Callable<T>

Keybase proof

I hereby claim:

  • I am mnadel on github.
  • I am mnadel (https://keybase.io/mnadel) on keybase.
  • I have a public key whose fingerprint is 026C 37B7 178B 36E9 87B0 2765 AA7A EA3E 31CC 9983

To claim this, I am signing this object:

@mnadel
mnadel / gist:aae1b4092cb2c5b0d521
Created November 7, 2014 17:06
Golang Concurrency Pattern
package main
import (
"sync"
"fmt"
)
func main() {
ch := make(chan int)
var wg sync.WaitGroup
@mnadel
mnadel / ThrottledTplDataflowPipelne.cs
Last active May 25, 2020 17:47
Applying Backpressure (aka Throttling) in TPL Dataflow
using System.Threading;
using System.Threading.Tasks.Dataflow;
class Pipeline<T>
{
private readonly SemaphoreSlim _semaphore;
private readonly BufferBlock<T> _buffer;
Pipeline(Action<T> action, int capacity)
{
@mnadel
mnadel / gist:bb4308d37840a8238939
Created February 9, 2016 15:32
Hate vim? Interactive rebase with Notepad++ instead.
C:\> git config --global core.editor "C:/Progra~2/Notepad++/notepad++.exe -multiInst -nosession -noPlugin """$*""""
@mnadel
mnadel / change-mac
Last active December 24, 2016 02:52
Change your Mac's MAC
#!/usr/bin/env bash
MYMAC=$(/usr/sbin/networksetup -getmacaddress Wi-Fi | grep -oE "[a-zA-Z0-9]{2}:([a-zA-Z0-9]{2}:?)+")
if [ "$1" == "--help" ] || [ $# -gt 1 ]; then
echo "usage: $(basename $0) [--random|--orig]"
exit 1
fi
if [ $# -eq 0 ] || [ "$1" == "--random" ]; then