Skip to content

Instantly share code, notes, and snippets.

View brianz's full-sized avatar

Brian Zambrano brianz

View GitHub Profile
gabeweaver / react-cognito-auth-js.js
Last active January 20, 2024 15:03
React + Cognito User Pools + Cognito Identity JS Example
This example was built using standard create-react-app out of the box with no modifications or ejections
to the underlying scripts.
In this example, i'm using Google as a social provider configured within the Cognito User Pool.
Each step also represents a file, so you can see how I've chosen to organize can do it however
you'd like so long as you follow the basic flow (which may or may not be the official way....but its what I found that works.
The docs are pretty horrible)
fgilio / axios-catch-error.js
Last active April 11, 2024 19:02
Catch request errors with Axios
* Handling Errors using async/await
* Has to be used inside an async function
try {
const response = await axios.get('');
// Success 🎉
} catch (error) {
// Error 😨
brianz /
Last active August 11, 2016 04:35
brianz's tech scratch pad

Sum column using awk

cat count.txt | awk '{sum+=$1} END {print sum}'

List open ports

linux: netstat -lnptu
mac: netstat -a -p tcp
bsweger /
Last active April 19, 2024 18:04
Useful Pandas Snippets

Useful Pandas Snippets

A personal diary of DataFrame munging over the years.

Data Types and Conversion

Convert Series datatype to numeric (will error if column has non-numeric values)
(h/t @makmanalp)

tito /
Created November 12, 2013 15:28
Bluetooth example on Android using Python / Pyjnius
Bluetooth/Pyjnius example
This was used to send some bytes to an arduino via bluetooth.
The app must have BLUETOOTH and BLUETOOTH_ADMIN permissions (well, i didn't
tested without BLUETOOTH_ADMIN, maybe it works.)
Connect your device to your phone, via the bluetooth menu. After the
pairing is done, you'll be able to use it in the app.
SEJeff / gist:5257789
Created March 27, 2013 20:36
Example salt config for preferencing dev but falling back to prod
# This would go in /etc/salt/master
- /srv/salt/base
- /srv/salt/dev
- /srv/salt/qa
- /srv/salt/base
Mins /
Last active February 16, 2024 00:03
Automating mysql_secure_installation
aptitude -y install expect
// Not required in actual script
SECURE_MYSQL=$(expect -c "
set timeout 10
evildmp / gist:3094281
Last active June 30, 2023 10:55
Set up Django, nginx and uwsgi

This document has now been incorporated into the uWSGI documentation:

Set up Django, nginx and uwsgi

Steps with explanations to set up a server using:

marktheunissen / pedantically_commented_playbook.yml
Last active March 31, 2024 18:45 — forked from phred/pedantically_commented_playbook.yml
Insanely complete Ansible playbook, showing off all the options
This playbook has been removed as it is now very outdated.
afternoon /
Created December 5, 2011 14:42
Remove large objects from a git repository
# git-slim
# Remove big files from git repo history.
# Requires GitPython (
# References:
# -