Skip to content

Instantly share code, notes, and snippets.

View arowla's full-sized avatar

Alison Rowland arowla

  • Stitch Fix
  • Chicagoland, USA
View GitHub Profile
@josephspurrier
josephspurrier / values_pointers.go
Last active July 15, 2024 16:04
Golang - Asterisk and Ampersand Cheatsheet
/*
********************************************************************************
Golang - Asterisk and Ampersand Cheatsheet
********************************************************************************
Also available at: https://play.golang.org/p/lNpnS9j1ma
Allowed:
--------
p := Person{"Steve", 28} stores the value
@douglasmiranda
douglasmiranda / option1.py
Last active April 25, 2024 09:10
Fix: Django Debug Toolbar not showing when using with Docker.
# YOU MAY WANT TO CHECK THIS OUT: https://github.com/douglasmiranda/ddpt/blob/master/{{cookiecutter.django_project_name}}/{{cookiecutter.django_project_name}}/config/local.py
# If you don't do this you will have to add the host IP in INTERNAL_IPS = ('127.0.0.1',)
# And it will change, then you will have to change INTERNAL_IPS again.
def show_toolbar(request):
if request.is_ajax():
return False
return True
@rebeccawilliams
rebeccawilliams / kaitlin.py
Created April 23, 2014 21:13
going away love for Kaitlin from her Python students
import os
from time import sleep
Kaitlin = "Awesome!"
# made with love by Lindsay
print "Thank you Kaitlin!"
sleep(1)
print "for teaching us useful things like..."
sleep(1)
@gtfierro
gtfierro / run_ocr.sh
Last active May 11, 2022 16:57
Quick shell script for parallel OCR on PDFs using ghostscript and tesseract
#!/bin/bash
# requires ghostscript (http://www.ghostscript.com/)
# requires ImageMagick
# requires tesseract (https://code.google.com/p/tesseract-ocr/)
# requires GNU parallel (https://www.gnu.org/software/parallel/)
# all of these are typically available through yum/apt/brew/etc.
# number of cores over which the process will be parallelized
num_cores=$1
@stevehanson
stevehanson / es-attach-full.py
Last active November 22, 2020 21:22
Interactive Python script to recursively index files in directory tree to elasticSearch using the elasticsearch-mapper-attachments (https://github.com/elasticsearch/elasticsearch-mapper-attachments) plugin to index files (pdf, docx, html, etc).
import os
import sys
# constants, configure to match your environment
HOST = 'http://localhost:9200'
INDEX = 'test'
TYPE = 'attachment'
TMP_FILE_NAME = 'tmp.json'
# for supported formats, see apache tika - http://tika.apache.org/1.4/formats.html
INDEX_FILE_TYPES = ['html','pdf', 'doc', 'docx', 'xls', 'xlsx', 'xml']
@stevehanson
stevehanson / es-attach.py
Last active February 13, 2017 11:39
Example using the elasticsearch-mapper-attachments (https://github.com/elasticsearch/elasticsearch-mapper-attachments) plugin to index files (pdf, docx, html, etc). Usage with "python es-attach.py my-filename. Credit to Lucas Vlcek's similar Gist using Perl - https://gist.github.com/lukas-vlcek/1075067.
import os
import sys
# constants, configure to match your environment
HOST = 'http://localhost:9200'
INDEX = 'test'
TYPE = 'attachment'
TMP_FILE_NAME = 'tmp.json'
@andrewvc
andrewvc / elasticsearch.conf
Created October 3, 2013 17:05
Upstart script for elasticsearch on ubuntu.... that actually works. Install the deb, and then run `sudo update-rc.d elasticsearch remove -f` to disable the init script.
# ElasticSearch upstart script
description "ElasticSearch service"
start on (net-device-up
and local-filesystems
and runlevel [2345])
stop on runlevel [016]
@karmi
karmi / test.doc
Last active March 25, 2017 09:57
Example of Elasticsearch's attachment handling
@justincampbell
justincampbell / after.sh
Created March 1, 2013 17:45
Jenkins + GitHub Commit Status API
if [[ $BUILD_STATUS == "success" ]]
then
export STATUS="success"
else
export STATUS="failure"
fi
curl "https://api.github.com/repos/justincampbell/my_repo/statuses/$GIT_COMMIT?access_token=abc123" \
-H "Content-Type: application/json" \
-X POST \