Skip to content

Instantly share code, notes, and snippets.

View rsperl's full-sized avatar

Richard rsperl

  • North Carolina, United States
View GitHub Profile
@rsperl
rsperl / main.go
Last active July 25, 2022 15:30 — forked from salihzain/main.go
Go code to get the name of the function that invoked the current function #snippet
package main
import (
"fmt"
"runtime"
)
// whoCalledMe is a function that returns the name, fileName, and lineNumber of the caller that called function X
// the code doesn't check for edge cases
func whoCalledMe() (callerName, callerFileName string, callerLineNumber int) {
@rsperl
rsperl / script-template.sh
Last active July 25, 2022 13:11 — forked from m-radzikowski/script-template.sh
Bash Template #snippet
#!/usr/bin/env bash
# custom set -x output
PS4='+(${BASH_SOURCE}:${LINENO}): ${FUNCNAME[0]:+${FUNCNAME[0]}(): }'
# set -x
set -Eeuo pipefail
cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1
@rsperl
rsperl / go-build.sh
Last active July 25, 2022 15:26 — forked from sivel/go-build.sh
Ansible Binary Golang Module #snippet
go build helloworld.go
GOOS=windows GOARCH=amd64 go build helloworld.go
@rsperl
rsperl / README.md
Last active July 25, 2022 15:03 — forked from steve-jansen/README.md
Stop and start Symantec Endpoint Protection on OS X #nosnippet

This script enables you stop and start Symantec Endpoint Protection on OS X

Installation

sudo curl https://gist.githubusercontent.com/steve-jansen/61a189b6ab961a517f68/raw/sep -o /usr/local/bin/sep
sudo chmod 755 /usr/local/bin/sep
sudo chown root:staff /usr/local/bin/sep
@rsperl
rsperl / M2M_Association_SQLalchemy.py
Last active July 25, 2022 13:48 — forked from SuryaSankar/M2M_Association_SQLalchemy.py
An example of a many to many relation via Association Object in SQLAlchemy #snippet
import sqlalchemy
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, Integer, String, ForeignKey
from sqlalchemy.orm import sessionmaker, relationship, backref
from sqlalchemy.ext.associationproxy import association_proxy
import uuid
engine = sqlalchemy.create_engine('sqlite:///:memory:')
Base = declarative_base()