Skip to content

Instantly share code, notes, and snippets.

Avatar

Chris Fitzpatrick cfitz

  • Machine Games
  • Sweden
View GitHub Profile
View gist:12b46314efb51eee1f1d604977cb85de
import synonyms from './synonyms'
// Keywords that should not be stemmed
const swedishKeywords = ['senior', 'island']
const indexConfig = {
settings: {
index: {
'mapping.total_fields.limit': 2200,
number_of_shards: 1,
number_of_replicas: 2,
View tests
-----------------------------------
Kuben Stage
( 1 worker, 1 thread, react-rails prerender on, no OJ, JEMALLOC OFF, 5 apps)
-----------------------------------
Total allocated: 24312661 bytes (249894 objects)
Total retained: 1223539 bytes (4574 objects)
allocated memory by gem
View e2e_test.rb
# config/initializers/e2e_test.rb
# For some situations, we need to have the e2e
# test to behave different in order to speed up the tests.
# rubocop:disable Style/ClassVars
if ENV.fetch('E2E_TEST', 'false') == 'true'
require_relative '../../lib/util/az_list_controller_util'
module Util
class AzListControllerUtil
class << self
View solrQuery.ts
import Fq from './fq'
import { SolrQueryOptions } from '../../types/types'
import SolrParams from './solrParams'
class SolrQuery {
// Filters
fqs: Fq[]
// Query
q: string
@cfitz
cfitz / default
Created Mar 21, 2019
INCF ElasticSearch NGINX configuration
View default
server {
listen 443;
server_name localhost;
ssl_certificate /etc/ssl/certs/STAR_incf_org-chained.crt;
ssl_certificate_key /etc/ssl/private/STAR_incf_org.key;
ssl on;
ssl_session_cache builtin:1000 shared:SSL:10m;
View decrypt.py
from Crypto.PublicKey import RSA
from Crypto.Cipher import PKCS1_v1_5 as Cipher_PKCS1_v1_5
from base64 import b64decode
# uses pycryptodome (3.7.2)
file_in = open('private.pem','rb').read()
key = RSA.import_key(file_in) # import the public key
# we make our cipher
cipher = Cipher_PKCS1_v1_5.new(key)
View fix_sort_names.rb
# plugins/local/backend/model/fix_sort_names.rb
[ NameCorporateEntity, NameFamily, NamePerson, NameSoftware].each do |klass|
$stderr.puts "Updating ... #{klass}"
klass.all.each do |obj|
# get the jsonmodel
@cfitz
cfitz / gitflow-breakdown.md
Created Oct 31, 2017 — forked from JamesMGreene/gitflow-breakdown.md
A comparison of using `git flow` commands versus raw `git` commands.
View gitflow-breakdown.md

Initialize

gitflow git
git flow init git init
git commit --allow-empty -m "Initial commit"
git checkout -b develop master

Connect to the remote repository

@cfitz
cfitz / login_test.rb
Last active Sep 22, 2017
example integration test using rack-cas, capybara, and minitest
View login_test.rb
# to do integration tests with rack-cas, you have to use the FakeCas middleware, which intercepts CAS redirects and
# displays a "fake CAS" login form. This form will give a token to anything, but it has to be a user that's in the
# DB for the application to log the user in.
# To set this up, add
# config/environments/test.rb :
# config.rack_cas.fake_attributes = { 'admin': { "admin": true, "cas_directory_id": "admin", "name": "admin" } }
# test/test_helper.rb:
# require 'capybara/rails'
@cfitz
cfitz / http.rb
Created May 17, 2017
Use HTTPS if post is set to 443/8443
View http.rb
require 'net/http'
class Net::HTTP
singleton_class.send(:alias_method, :start_orig, :start)
class << self
def start(address, *arg, &block)
opt = Hash.try_convert(arg[-1]) ? arg.pop : {}
opt[:use_ssl] = ( [ 443, 8443 ].include?(arg.first) )
arg << opt