This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
---------------------------------------------------------------------------------------------------- | |
tcpdump -s 0 #capture entire etherner header and IP packet | |
tcpdump -ni tap55ec3c7f-91 ip6 #locate the ICMPv6 packets | |
tcpdump -s0 -n -i any -w /tmp/$(hostname)-smbtrace.pcap #if the SMB client or SMB server is a Unix host,Troubleshooting Server Message Block (SMB) | |
tcpdump -D #Print the list of the network interfaces available on the system and on which tcpdump can capture packet | |
tcpdump -X -vvv -n -i eth0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var newLine = []byte("\n")[0] | |
var goPathPrefix = "\t/go/src/" | |
var goUsersPrefix = "\t/Users/" | |
func dumpStacktrace(skipLines int) []byte { | |
stack := debug.Stack() | |
init, lines := 0, 0 | |
// First pass: seek stack start skiping lines if necessary | |
if skipLines > 0 { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Run tests for package in current location | |
go test -run=. -bench=. -benchtime=5s -count 5 -benchmem -cpuprofile=cpu.out -memprofile=mem.out -trace=trace.out ./ | tee bench.txt | |
go tool pprof -http :8080 cpu.out | |
go tool pprof -http :8081 mem.out | |
go tool trace trace.out | |
go tool pprof $FILENAME.test cpu.out | |
# (pprof) list <func name> | |
# go get -u golang.org/x/perf/cmd/benchstat |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install tzdata (used by golang timezones) along with other base & useful commands | |
RUN INSTALL_PKGS="wget diffutils net-tools bind-utils iproute nmap procps-ng vim-enhanced nano less libidn git gcc tzdata libaio make tzdata git" && \ | |
dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm -y && \ | |
dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ | |
dnf update -y && \ | |
dnf clean all -y && \ | |
rm -rf /var/cache/dnf/* | |
# Install Oracle Instant Client, SQLPlus and GCC for golang interop | |
ARG OIC_RELEASE=19 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo "** running formatters" | |
goimports -e -w -local my.domain.corp $(find . -type f -name '*.go' -not -path "./vendor/*") | |
# use gofumpt if available, see https://github.com/mvdan/gofumpt | |
if ! command -v gofumpt -version &> /dev/null | |
then | |
echo "gofumpt could not be found, defaulting to gofmt" | |
gofmt -s -w $(find . -type f -name '*.go' -not -path "./vendor/*") | |
else | |
echo "gofumpt found, executing as formatter" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
echo $BASH_VERSION | |
# GVM readme: https://github.com/e-nikolov/gvm/blob/master/README.md | |
bash < <(curl -s -S -L https://raw.githubusercontent.com/e-nikolov/gvm/master/binscripts/gvm-installer) | |
source $HOME/.gvm/scripts/gvm | |
# To view available versions to install run 'gvm listall' later on | |
# Older versions you'll probably not need |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
__author__ = "lggomez" | |
__copyright__ = "Copyright 2017" | |
__credits__ = ["Luis Gomez"] | |
__license__ = "MIT" | |
__version__ = "0.3" | |
__maintainer__ = "lggomez" | |
__status__ = "Production" | |
import argparse | |
import os |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MyStack<T> | |
{ | |
readonly int m_Size; | |
readonly T[] m_Items; | |
int m_StackPointer = 0; | |
public MyStack(int size) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static List<MethodInfo> GetTypeMethods<T>() | |
{ | |
List<MethodInfo> interfaceMethods = new List<MethodInfo>(); | |
var targetType = typeof(T); | |
foreach (MethodInfo method in targetType.GetMethods() ) | |
{ | |
if (!method.IsSpecialName && | |
!new List<string> { "tostring", "gethashcode", "equals", "gettype", "finalize", "memberwiseclone" }.Any(method.Name.ToLowerInvariant().Contains)) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Reflection; | |
using System.Runtime.CompilerServices; | |
using System.Runtime.Remoting; | |
using Bootstrapper.IoC.Behaviors; | |
using Microsoft.Practices.Unity; | |
using Microsoft.Practices.Unity.InterceptionExtension; |
NewerOlder