Skip to content

Instantly share code, notes, and snippets.

@samuelharmer
samuelharmer / go-os-arch.md
Created April 29, 2021 07:13 — forked from asukakenji/0-go-os-arch.md
Go (Golang) GOOS and GOARCH

Go (Golang) GOOS and GOARCH

All of the following information is based on go version go1.14.7 darwin/amd64.

A list of valid GOOS values

(Bold = supported by go out of the box, ie. without the help of a C compiler, etc.)

  • aix
  • android
@samuelharmer
samuelharmer / ks-centos7-pxe-server.cfg
Created October 27, 2020 18:37 — forked from wilkersoncs/ks-centos7-pxe-server.cfg
Kickstart to create CentOS 7 PXE Server with sample network install kickstart
#version=DEVEL
##Adapted from procedures from https://www.linuxtechi.com/configure-pxe-installation-server-centos-7/
##Use by pressing tab on CentOS install screen and adding
## ks=hd:sdb1:/ks-pxe.cfg
##Make sure target system has 2GB of RAM
firewall --disabled
selinux --disabled
# System authorization information
auth --enableshadow --passalgo=sha512
# Use CDROM installation media
@samuelharmer
samuelharmer / Use-Impersonation.ps1
Created September 16, 2020 12:17 — forked from idavis/Use-Impersonation.ps1
Impersonate a user and execute a script block as that user
param( [ScriptBlock] $scriptBlock )
<#
.SYNOPSIS
Impersonates a user and executes a script block as that user. This is an interactive script
and a window will open in order to securely capture credentials.
.EXAMPLE
Use-Impersonation.ps1 {Get-ChildItem 'C:\' | Foreach { Write-Host $_.Name }}
This writes the contents of 'C:\' impersonating the user that is entered.
#>
@samuelharmer
samuelharmer / bash_history.sh
Last active September 16, 2020 08:56 — forked from ckabalan/best_bash_history.sh
The Best Bash History Settings Ever
# /etc/profile.d/bash_history.sh
# Save 5,000 lines of history in memory
HISTSIZE=10000
# Save 2,000,000 lines of history to disk (will have to grep ~/.bash_history for full listing)
HISTFILESIZE=2000000
# Append to history instead of overwrite
shopt -s histappend
# Ignore redundant or space commands
HISTCONTROL=ignoreboth
# Ignore more
#!/usr/bin/bash
which ansible >/dev/null 2>&1
if [ $? -ne 0 ];
then
echo "Installing Ansible..."
sleep 5
pushd .
cd ~
pacman -S libyaml-devel python2 tar libffi libffi-devel gcc pkg-config make openssl-devel openssh libcrypt-devel --noconfirm --needed
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
@samuelharmer
samuelharmer / one_flask.py
Created May 12, 2020 07:15 — forked from mikefromit/one_flask.py
a one file flask app for trying stuff
# THIS PROJECT IS AN EXAMPLE APP. SOME CODE MAY NOT BE ACTUALLY USEFUL
# FOR DEMONSTRATION PURPOSES ONLY
# YOUR MILEAGE MAY VARY
# Requirements are Flask, Flask-WTF, Flask-SQLAlchemy
import os
from flask import (Flask,
Blueprint,
redirect,
@samuelharmer
samuelharmer / server.py
Created February 13, 2020 11:08 — forked from mdonkers/server.py
Simple Python 3 HTTP server for logging all GET and POST requests
#!/usr/bin/env python3
"""
Very simple HTTP server in python for logging requests
Usage::
./server.py [<port>]
"""
from http.server import BaseHTTPRequestHandler, HTTPServer
import logging
class S(BaseHTTPRequestHandler):