Skip to content

Instantly share code, notes, and snippets.

View DaddyMoe's full-sized avatar

Moses Mansaray DaddyMoe

View GitHub Profile
@DaddyMoe
DaddyMoe / SpringRestTemplateBasicAuthExample.java
Created June 22, 2017 17:12
Spring RestTemplate Basic Auth Example
public class SpringRestTemplateBasicAuthExample {
public static void main(String... args){
RestTemplate rt = new RestTemplate();
rt.getMessageConverters().add(new MappingJackson2HttpMessageConverter());
rt.getMessageConverters().add(new StringHttpMessageConverter());
String uri = new String("https://some.api.provider.com/rest/authenticate");
String plainCreds = "[email protected]:sfdfsdf$%&^$%4";
@DaddyMoe
DaddyMoe / Elasticsearch_all_field_include_all_poc.es
Last active December 11, 2017 18:35
Elasticsearch _all_ field POC enabling, excluding field and not_analysed fields
// lets create our index
PUT /t
{
"mappings": {
"t": {
"_all": {
"enabled": true
},
"properties": {
"one": {
@DaddyMoe
DaddyMoe / MergeTwoMapofStringListTogether.java
Last active April 6, 2019 21:47
Merge two Maps together of type: Map<String, List<String>>
// Merge two Maps together of type: Map<String, List<String>>
static BiFunction<Map<String, List<String>>, Map<String, List<String>>, Map<String, List<String>>> mergeMaps() {
return (Map<String, List<String>> map1, Map<String, List<String>> map2) -> {
Map<String, List<String>> mergedMapped = new HashMap<>(map1);
map2.forEach((String k, List<String> v) -> mergedMapped.merge(k, v, (strings, strings2) -> {
strings.addAll(strings2);
return strings;
})
);
### Keybase proof
I hereby claim:
* I am daddymoe on github.
* I am daddy_moe (https://keybase.io/daddy_moe) on keybase.
* I have a public key ASAfMlHY38ZDURK5lBgy1PhSHjtBOxDt3wqhhtGukCZ9sAo
To claim this, I am signing this object:
@DaddyMoe
DaddyMoe / CommandsKubernetesToolings.md
Last active April 12, 2019 11:35
Kubernetes Tools Commands for installation, reset and usage

Commands for kubernetes - DevOps

on macOS - minikube | kubectl | docker

Setup:

saml2aws login  #
saml2aws        # Opt: configure. To configure user details.
export AWS_PROFILE=<my_profile>  # Set default profile

Usage

@DaddyMoe
DaddyMoe / start_elasticsearch_kibana.sh
Created May 2, 2019 19:53
Start Elastiscearch and kibana in the background
#!/usr/bin/env bash
#
# Start Elasticsearch and kibana in the background.
# But only for the instance of the running terminal.
#
echo "starting sonar"
~/dev/apps/sonarqube-7.7/bin/macosx-universal-64/sonar.sh start
@DaddyMoe
DaddyMoe / CheatsheetsGcloudAndKubernetesCommands.md
Last active January 23, 2022 20:35
Cheat sheets: Gcloud and Kubernetes commands

Gcloud with Kubernetes

GCloud

gcloud help
gcloud projects list
gcloud projects create scaling-ms
gcloud projects delete my-project-1484614311039
gcloud compute zones list

gcloud config set compute/zone europe-west1-d

@DaddyMoe
DaddyMoe / postgres_jsonb_string_find_replacement.sql
Last active November 12, 2019 23:38
postgres jsonb string find and replacement
-- Create table
create table t1(doc jsonb);
-- Verify
SELECT * FROM t1;
-- insert some data
INSERT INTO t1
VALUES
@DaddyMoe
DaddyMoe / Java-Software-Development-setup-on-a-mac
Last active December 9, 2023 00:30
Environment setup for Java Software Development on a MacOS
Either follow this simple guide here or leverage other heavily oppinionated guides that are more comprehensive and community supported
# Option 1: Community support versions
First follow [xmlking's complete Mac setup](https://xmlking.gitbook.io/macos-setup/applications/sublime-text)
- General mac setup
- System preparedness and preferences - folders setup etc
- Application installations
@DaddyMoe
DaddyMoe / airflow_commands.md
Last active June 20, 2023 09:52
airflow cheatsheet commands

Airflow cheatsheet commands

Helpppppppppp

airflow -h

Setup

~/airflow is the default home directory