Skip to content

Instantly share code, notes, and snippets.

View pgilad's full-sized avatar
🔭

Gilad Peleg pgilad

🔭
View GitHub Profile
@pgilad
pgilad / AggregateControllerTest.java
Created February 17, 2019 19:12
An example on how to use WebFluxTest to test a Spring Boot WebFlux Controller
package com.blazemeter.dagger.domains.aggregate;
import com.blazemeter.dagger.domains.aggregate.port.AggregateRepository;
import com.blazemeter.dagger.domains.common.CollectionService;
import org.apache.commons.lang3.RandomUtils;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.ArgumentMatchers;
import org.mockito.Mockito;
import org.springframework.beans.factory.annotation.Autowired;
@pgilad
pgilad / DemoController.java
Last active December 17, 2020 08:29
Supporting files for my blog post on remote jmx Spring Boot debugging
package com.example.demo;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Mono;
@RestController
public class DemoController {
@GetMapping("/ping")
@pgilad
pgilad / kube-resources.sh
Created June 6, 2019 07:22
Get ALL resources in k8s namespace
#!/bin/bash
kubectl api-resources --verbs=list --namespaced -o name | xargs -n 1 kubectl get --show-kind --ignore-not-found
@pgilad
pgilad / get-token.fish
Last active June 8, 2019 05:57
Get k8s dashboard token for dashboard
#!/usr/bin/env fish
kubectl -n kube-system describe secrets (kubectl -n kube-system get secrets | awk '/clusterrole-aggregation-controller/ {print $1}') | awk '/token:/ {print $2}'
@pgilad
pgilad / apache-zeppelin.rb
Created July 14, 2019 05:37
Apache Zeppelin Brew Formula 0.7.3 (for AWS Glue compatibility)
class ApacheZeppelin < Formula
desc "Web-based notebook that enables interactive data analytics"
homepage "https://zeppelin.apache.org"
url "http://archive.apache.org/dist/zeppelin/zeppelin-0.7.3/zeppelin-0.7.3-bin-all.tgz"
sha256 "7e657df51ecfd4aad39d42f8578409692244d36b2da92b5dbd3b6957b829bf58"
head "https://github.com/apache/zeppelin.git"
bottle :unneeded
def install
@pgilad
pgilad / lambda-talk.js
Created August 15, 2019 11:05
AWS Lambda PolyTalk Slack Integration
const querystring = require('querystring');
const request = require('request-promise-native');
// You must bundle the latest version of the AWS JS SDK (2.7.9)
// The built-in SDK version does not know about the Polly text-to-speech service.
const AWS = require('aws-sdk');
const SLACK_TOKEN = process.env.SLACK_TOKEN;
const SLACK_UPLOAD_URI = 'https://slack.com/api/files.upload';
const AUDIO_FILENAME = 'audio.mp3';
const MAX_ALLOWED_TEXT_LENGTH = 140;
@pgilad
pgilad / docker-compose-opt.service
Last active August 19, 2019 05:43
Docker Compose Pi3 Applications Service
# File: /etc/systemd/system/docker-compose-opt.service
[Unit]
Description=Docker Compose Opt Service
Requires=docker.service network-online.target
After=docker.service network-online.target
[Service]
WorkingDirectory=/opt/applications
Type=oneshot

Keybase proof

I hereby claim:

  • I am pgilad on github.
  • I am pgilad (https://keybase.io/pgilad) on keybase.
  • I have a public key ASBURBqbd1OGVMnPWZLRaIr3vrOADTQSDCGadoHfy_5d1go

To claim this, I am signing this object:

@pgilad
pgilad / .vimrc
Created October 27, 2019 07:22
Securely support `modelines` in Vim
" https://github.com/numirias/security/blob/master/doc/2019-06-04_ace-vim-neovim.md#patches
if has('patch-8.1.1366')
set modelines=5
set nomodelineexpr
set modeline
else
set nomodeline
endif
@pgilad
pgilad / hostname.fish
Created November 2, 2019 15:02
Update mac names
set -l name Gilad-MBP-Personal
sudo scutil --set ComputerName $name
sudo scutil --set LocalHostName $name
sudo scutil --set HostName $name
dscacheutil -flushcache
sudo reboot