Skip to content

Instantly share code, notes, and snippets.

Avatar

Brian Zambrano brianz

View GitHub Profile
@gabeweaver
gabeweaver / react-cognito-auth-js.js
Last active March 10, 2023 14:32
React + Cognito User Pools + Cognito Identity JS Example
View react-cognito-auth-js.js
/*
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 stuff...you 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
fgilio / axios-catch-error.js
Last active March 14, 2023 13:11
Catch request errors with Axios
View axios-catch-error.js
/*
* Handling Errors using async/await
* Has to be used inside an async function
*/
try {
const response = await axios.get('https://your.site/api/v1/bla/ble/bli');
// Success 🎉
console.log(response);
} catch (error) {
// Error 😨
@brianz
brianz / tech-scratch-pad.md
Last active August 11, 2016 04:35
brianz's tech scratch pad
View tech-scratch-pad.md

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
bsweger / useful_pandas_snippets.md
Last active January 10, 2023 11:29
Useful Pandas Snippets
View useful_pandas_snippets.md

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
tito / bluetooth.py
Created November 12, 2013 15:28
Bluetooth example on Android using Python / Pyjnius
View bluetooth.py
'''
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
SEJeff / gist:5257789
Created March 27, 2013 20:36
Example salt config for preferencing dev but falling back to prod
View gist:5257789
# This would go in /etc/salt/master
file_roots:
base:
- /srv/salt/base
dev:
- /srv/salt/dev
- /srv/salt/qa
- /srv/salt/base
qa:
@Mins
Mins / mysql_secure.sh
Last active February 24, 2023 09:54
Automating mysql_secure_installation
View mysql_secure.sh
#!/bin/bash
aptitude -y install expect
// Not required in actual script
MYSQL_ROOT_PASSWORD=abcd1234
SECURE_MYSQL=$(expect -c "
set timeout 10
@evildmp
evildmp / gist:3094281
Last active March 9, 2023 11:12
Set up Django, nginx and uwsgi
View gist:3094281

This document has now been incorporated into the uWSGI documentation:

http://uwsgi-docs.readthedocs.org/en/latest/tutorials/Django_and_nginx.html

Set up Django, nginx and uwsgi

Steps with explanations to set up a server using:

@marktheunissen
marktheunissen / pedantically_commented_playbook.yml
Last active March 4, 2023 01:41 — forked from phred/pedantically_commented_playbook.yml
Insanely complete Ansible playbook, showing off all the options
View pedantically_commented_playbook.yml
This playbook has been removed as it is now very outdated.
@afternoon
afternoon / git-slim.py
Created December 5, 2011 14:42
Remove large objects from a git repository
View git-slim.py
#!/usr/bin/python
#
# git-slim
#
# Remove big files from git repo history.
#
# Requires GitPython (https://github.com/gitpython-developers/GitPython)
#
# References:
# - http://help.github.com/remove-sensitive-data/