Skip to content

Instantly share code, notes, and snippets.

@jeffcjohnson
jeffcjohnson / Api.ts
Created September 1, 2020 14:21
Call API with Axios in React Typescript
import {Dispatch, Reducer, SetStateAction, useEffect, useReducer, useState} from 'react';
import axios, {AxiosRequestConfig} from 'axios';
enum FetchActionType {
FetchInit,
FetchSuccess,
FetchFailure,
}
type Action<T> = {
@jeffcjohnson
jeffcjohnson / set-jetbrains-inotify.sh
Last active February 1, 2019 04:29
IntelliJ / PyCharm / JetBrains - Increase inotify watch limit
echo "fs.inotify.max_user_watches = 524288" | sudo tee --append /etc/sysctl.d/60-jetbrains.conf
sudo sysctl -p --system

Keybase proof

I hereby claim:

  • I am jeffcjohnson on github.
  • I am jeffcjohnson (https://keybase.io/jeffcjohnson) on keybase.
  • I have a public key whose fingerprint is E2F6 C5DB 4E6C A502 BA81 E298 4A4D 608B 82FF 3401

To claim this, I am signing this object:

@jeffcjohnson
jeffcjohnson / aws_sqs.py
Created May 7, 2015 13:16
Create or update AWS SQS queue and dead letter queue in Python using boto
import boto.sqs
import json
import logging
def setup_queue(conn, q_name, dlq_name):
q = conn.lookup(q_name)
if q is None:
logging.info("creating queue %s", q_name)
q = conn.create_queue(q_name)
addresses/address/_count w/ body"
{
"filtered": {
"query": {
"match_all": {}
},
"filter": {
"or": [
{
"missing": {
@jeffcjohnson
jeffcjohnson / gist:1051555
Created June 28, 2011 16:42
elastic search distance filter
curl -XPUT 'http://localhost:9200/pins/pin/1' -d '
{
"pin" : {
"location" : {
"lat" : 40.12,
"lon" : -71.34
},
"tag" : ["food", "family"],
"text" : "my favorite family restaurant"
}