Skip to content

Instantly share code, notes, and snippets.

🎯
Making an impact

Mark McDonnell Integralist

🎯
Making an impact
View GitHub Profile
@Integralist
Integralist / simple xhr function.js
Last active Jul 10, 2020
[Simple XHR function] #js #javascript #xhr #ajax
View simple xhr function.js
function request(url, params, callback) {
/*
var params = 'pass=' + encodeURIComponent(password.value) +
'&encval=' + encodeURIComponent(encval.value) +
'&code=' + encodeURIComponent(code.value) +
'&username=' + encodeURIComponent(username.value) +
'&_xsrf=' + encodeURIComponent(xsrf);
*/
var xhr = new XMLHttpRequest();
@Integralist
Integralist / golang check if struct is a specific type.go
Last active Jul 8, 2020
[golang check if struct is a specific type] #go #golang #struct #type #assert #check
View golang check if struct is a specific type.go
package main
import "fmt"
type Test struct {
foo int
}
type TestA struct {
Test
@Integralist
Integralist / fuzz.bash
Last active Jul 7, 2020
[Golang example of Fuzz Testing] #go #golang #fuzz #testing #pentesting
View fuzz.bash
# https://github.com/ffuf/ffuf
#
# FUZZ is replaced with symbol in fuzz.txt
ffuf -t 40 -r -w ./fuzz.txt -u "https://example.com/FUZZ" -maxtime 60 -v -c
@Integralist
Integralist / Example.Dockerfile
Last active Jun 18, 2020
[Compile Curl] #debian #compile #curl
View Example.Dockerfile
FROM python:3.8-slim
# libbrotli from debian apt, and build tools
RUN apt-get update && apt-get install -y git build-essential autoconf automake libtool brotli libbrotli-dev zlib1g-dev pkg-config cmake golang
# nghttp2 dev libraries - curl http2 support
RUN git clone https://github.com/tatsuhiro-t/nghttp2.git /tmp/nghttp2
WORKDIR /tmp/nghttp2
RUN autoreconf -i && automake && autoconf
RUN ./configure
@Integralist
Integralist / NSQ Questions.md
Last active Jun 17, 2020
[NSQ Questions] some questions I received from someone new to NSQ #nsq #python #pynsq #tornado #queues #buzzfeed #work
View NSQ Questions.md

Below is my response to a colleague who was new to NSQ and had some questions about an application he was building.

Note: bf_nsq is an internal BuzzFeed abstraction on top of pynsq.


Heya 👋🏻

Are there any limits I should be aware of when using BF NSQ? ie. queue size, message size, requeues/max tries, response times, etc.

@Integralist
Integralist / Caution with Bash when copying Files and Directories.bash
Created Jun 15, 2020
[Caution with Bash when copying Files and Directories] #bash #cp #copy #files #directories
View Caution with Bash when copying Files and Directories.bash
# copy src directory into the destionation directory
cp -r src ~/Code/rust/compute@edge/
# copy the files within src directory into the destionation directory
#
# NOTICE the subtle difference! a trailing slash on src/ will
# copy the files within that directory rather than the directory as a whole.
cp -r src/ ~/Code/rust/compute@edge/
@Integralist
Integralist / sample.go
Created Jun 11, 2020
[Golang return random bool based on percentage] #golang #go #random #bool #sample #logs #percentage
View sample.go
// sample returns True randomly at a percentage of the time
func sample(percent int) bool {
return rand.Intn(100) < percent
}
@Integralist
Integralist / Makefile
Last active Jun 4, 2020
[Python3 Virtual Environment Makefile] #python #python3 #makefile #venv #virtual environment
View Makefile
dir := foobar
root := $(shell git rev-parse --show-toplevel)
# NOTE:
# activating the venv via `source` doesn't work so we use the . synonym instead.
venv:
@python3 -m venv .venv/rate_control; \
. .venv/$(dir)/bin/activate; \
python3 -m pip install --quiet --upgrade pip; \
python3 -m pip install --quiet -r $(root)/$(dir)/scripts/requirements.txt
@Integralist
Integralist / enum example.py
Last active Jun 3, 2020
[Python Enum Example] #python #python3 #enum
View enum example.py
"""
the 'inherit from enum' class approach helps give structure to otherwise
much more verbose constants.
for example...
RenderMode.HUMAN_READABLE
RenderMode.STRUCTURED_JSON
vs
@Integralist
Integralist / Logging Message Format.md
Created May 13, 2020
[Logging Message Format] #logging #message #format
View Logging Message Format.md

NOUN_STATE or NOUN_VERB_STATE

You can’t perform that action at this time.