Skip to content

Instantly share code, notes, and snippets.

View cfitz's full-sized avatar

Chris Fitzpatrick cfitz

  • Machine Games
  • Sweden
View GitHub Profile
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,
@cfitz
cfitz / tests
Last active March 27, 2020 07:13
-----------------------------------
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
@cfitz
cfitz / e2e_test.rb
Last active January 28, 2020 20:53
# 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
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 March 21, 2019 10:15
INCF ElasticSearch NGINX configuration
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;
@cfitz
cfitz / decrypt.py
Last active December 27, 2018 17:23
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)
# 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 October 31, 2017 10:14 — forked from JamesMGreene/gitflow-breakdown.md
A comparison of using `git flow` commands versus raw `git` commands.

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

!function(e){function t(n){if(r[n])return r[n].exports;var a=r[n]={exports:{},id:n,loaded:!1};return e[n].call(a.exports,a,a.exports,t),a.loaded=!0,a.exports}var r={};return t.m=e,t.c=r,t.p="/static/",t(0)}([function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}var a=r(1);n(a)},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var a=r(2),i=n(a);t["default"]=i["default"]},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,
@cfitz
cfitz / login_test.rb
Last active September 22, 2017 22:12
example integration test using rack-cas, capybara, and minitest
# 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'