Skip to content

Instantly share code, notes, and snippets.

@rafanoronha
rafanoronha / index.ts
Created August 5, 2023 21:26
Open AI API snippet
export { Content, initContentModel } from './model'
import { Configuration, OpenAIApi } from 'openai'
const configuration = new Configuration({
apiKey: process.env.OPENAI_API_KEY,
})
const openai = new OpenAIApi(configuration)
config :apply,
lorem_ipsum_result_feature_flag: false,
fake_lorem_ipsum_feature_flag: true,
fake_customer_event_feature_flag: true,
fake_lorem_ipsum_result_feature_flag: true
@rafanoronha
rafanoronha / gist:86f87f8fbd09f69ea2ed130500caf645
Created December 29, 2021 19:59
docker entrypoint override
ENTRYPOINT ["/bin/sh"]
CMD ["-c", "sleep 1h"]
defmodule Apply.ApplicationsProcessing.FoobarEligibility do
import Apply.ApplicationsProcessing.LoremIpsum
def is_foobar_eligible(%{some_attribute: true}), do: false
def is_foobar_eligible(%{some_other_attribute: true}), do: false
def is_foobar_eligible(%{something_else: false}), do: false
def is_foobar_eligible(%{exists_in_lorem_ipsum_foobar: true}), do: false
defmodule Apply.ApplicationsProcessing.FoobarEligibility do
import Apply.ApplicationsProcessing.LoremIpsum
def is_foobar_eligible(
%{
event_data: %{
"event_data_we_are_interested" => %{
"foo" =>
%{
@rafanoronha
rafanoronha / create_codacy_rollup_report.py
Created June 11, 2021 14:12
Create Codacy Rollup Report
import json, csv, requests, logging
logging.basicConfig(level=logging.DEBUG)
token = 'API TOKEN HERE'
base_url = 'https://app.codacy.com'
org_name = 'YOUR ORG HERE'
provider = 'GIT PROVIDER HERE' # Github -> gh, Github Enterprise -> ghe, Bitbucket -> bb, BitBucket Server -> bbe, Gitlab -> gl, Gitlab Enterprise -> gle
headers = {'Content-Type': 'application/json', 'Accept': 'application/json', 'api-token': token}
@rafanoronha
rafanoronha / CreateHelloWar.ps1
Created August 31, 2016 14:49
creates a java war application without any tooling beyond jdk
echo @"
----------------------------------------
----------------------------------------
----------------------------------------
hello servlet app
----------------------------------------
----------------------------------------
a hello servlet app will be created into ./app
setting up working dir...
@rafanoronha
rafanoronha / gist:11197589
Last active August 29, 2015 14:00
handy PostgreSQL commands
\?;
\d+;
\d+ TABLE_NAME;
drop schema SCHEMA_NAME cascade;
create schema SCHEMA_NAME authorization OWNER_NAME;
@rafanoronha
rafanoronha / gist:8245708
Created January 3, 2014 20:17
detecting phantomjs
//https://github.com/wjlroe/bowser/commit/26b760b0b1fc651a59cb0369e9a3520b2e241f1a
/phantom/i.test(navigator.userAgent)
@rafanoronha
rafanoronha / gist:7828657
Last active September 9, 2016 10:06
Setting up a Selenium Grid across Ubuntu Server instances

Setting up a Selenium Grid across Ubuntu Server instances

Initial setup for both hub and node instances:

.

sudo apt-get install openjdk-7-jre-headless
wget https://selenium.googlecode.com/files/selenium-server-standalone-2.38.0.jar
sudo apt-get install ruby1.9.1
sudo gem install foreman