This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
psfile=$1 | |
tmpfoo=`basename $0` | |
TMPDIR=`mktemp -d /tmp/${tempfoo}.XXXXXX` || exit 1 | |
echo $TMPDIR | |
gs -o $TMPDIR/%05d.png -sDEVICE=png16m -r300 -dPDFFitPage=true $psfile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="moment.min.js"></script> | |
<script src="moment-timezone-with-data-10-year-range.js"></script> | |
<script> | |
const my_zone = moment.tz.guess(true); | |
// Set up timezone selector with all the zones. | |
// The user's current guessed zone is selected. | |
const sel = document.querySelector('select.timezone'); | |
moment.tz.names().forEach( zone => { | |
option = document.createElement('option'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
from elasticsearch import Elasticsearch, TransportError | |
import argparse | |
import re | |
import sys | |
ap = argparse.ArgumentParser(description='Do a baseline run against an Elasticsearch index') | |
ap.add_argument('--host', default='localhost', help='Elasticsearch host') | |
ap.add_argument('--port', default=9200, help='Elasticsearch port') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.core.management.base import BaseCommand, CommandError | |
from django.utils.crypto import get_random_string | |
class Command(BaseCommand): | |
help='''Generate a secret key the same way Django does. | |
You will need to install it either in settings.py for dev or externally for production | |
''' | |
def add_arguments(self, parser): | |
parser.add_argument('-l', '--length', type=int, default=50) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.conf import settings | |
from django.core.files.storage import FileSystemStorage | |
from django.core.files.base import File | |
from django.utils.deconstruct import deconstructible | |
from git import Repo | |
import io | |
@deconstructible | |
class VersionedStorage(FileSystemStorage): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
if __name__ == "__main__": | |
import json | |
import argparse | |
import spacy | |
import dateparser | |
import signal | |
from contextlib import contextmanager | |
from tqdm import tqdm | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import json | |
import argparse | |
import re | |
# source files from https://github.com/bpb27/trump_tweet_data_archive | |
# Removes URLs since M-x cookie-doctor gets confused by them | |
argparser = argparse.ArgumentParser(description='Convert from JSON array of condensed tweets to cookie format') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// getTrueName.c | |
// | |
// DESCRIPTION | |
// Resolve HFS and HFS+ aliased files (and soft links), and return the | |
// name of the "Original" or actual file. Directories have a "/" | |
// appended. The error number returned is 255 on error, 0 if the file | |
// was an alias, or 1 if the argument given was not an alias | |
// | |
// BUILD INSTRUCTIONS | |
// gcc-3.3 -o getTrueName -framework Carbon getTrueName.c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <sys/types.h> | |
#include <dirent.h> | |
/** | |
* Usage: rm_all <dir-name> | |
* From lkml... | |
*/ | |
#define u32 unsigned int |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I had a large index job crash at about doc 75M. This is with CDH4.6. I could not list the /solr/overseer/queue directory in ZK because it had millions of entries. | |
Here are the steps I followed to avoid a re-index: | |
1. Shut down all solr-servers and zookeeper-servers | |
2. Run zookeeper-server-initialize --force --myid X on each ZK server. This should result in an empty ZK space. | |
3. solrctl --init | |
4. hadoop mv /solr/the-collection /hold | |
5. Restart solr-server instances | |
6. solrctl instancedir --create ... # re-upload the config info | |
7. solrctl collection --create # with the same number of nodes, repls, as before |
NewerOlder