Skip to content

Instantly share code, notes, and snippets.

🔭

Gilad Peleg pgilad

🔭
Block or report user

Report or block pgilad

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@pgilad
pgilad / Dockerfile
Last active Jan 2, 2019
Dockerfile to create a zip for AWS Lambda code based on Python 2.7 and Pipenv
View Dockerfile
FROM amazonlinux:latest
RUN yum -y update && yum install -y gcc python-devel zip which
RUN curl https://bootstrap.pypa.io/get-pip.py | python -
RUN pip install pipenv
ENV LANG en_US.UTF-8
ENV LC_ALL en_US.UTF-8
ENV SOURCE_DIR lambdas
@pgilad
pgilad / Deployment.java
Last active Jan 24, 2019
Example of how to patch a deployment image on Kubernetes using Java client
View Deployment.java
package com.blazemeter;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.kubernetes.client.ApiClient;
import io.kubernetes.client.ApiException;
import io.kubernetes.client.Configuration;
import io.kubernetes.client.apis.AppsV1beta1Api;
import io.kubernetes.client.models.AppsV1beta1Deployment;
@pgilad
pgilad / DataSender.java
Last active Dec 26, 2018
DataSender using Netty Reactive Client
View DataSender.java
package data;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import reactor.netty.ByteBufFlux;
import reactor.netty.http.client.HttpClient;
import reactor.retry.Retry;
import settings.Settings;
@pgilad
pgilad / build.gradle
Last active Dec 26, 2018
How to create reproducible builds in spring using buildInfo
View build.gradle
tasks.withType(AbstractArchiveTask) {
preserveFileTimestamps = false
reproducibleFileOrder = true
}
springBoot {
mainClassName = 'com.blazemeter.dagger.DaggerApplication'
buildInfo {
properties {
time = null
@pgilad
pgilad / account.ts
Last active Dec 26, 2018
An example of a model wrapping read only state using Typescript
View account.ts
import _ from 'lodash';
import produce from 'immer';
import { IAccount } from '../../types/account';
import { IData, IModifiable, ProduceRecipe } from '../metadata';
/**
* An account model
*/
export class Account implements IModifiable<IAccount>, IData<IAccount> {
readonly data: Readonly<IAccount>;
@pgilad
pgilad / script.js
Created Dec 2, 2018
Minimal compiler for typescript files
View script.js
const ts = require('typescript');
const tsConfig = require('./tsconfig.json');
const config = tsConfig.compilerOptions;
function compile(fileNames, options) {
if (fileNames.filter(Boolean).length === 0) {
console.log('No files');
return;
}
@pgilad
pgilad / ExampleWebFilter.java
Last active Sep 19, 2019
Try to use WebFilter in Spring Boot Webflux in order to log request body
View ExampleWebFilter.java
package com.blazemeter.dagger.config;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.springframework.web.server.ServerWebExchange;
import org.springframework.web.server.WebFilter;
import org.springframework.web.server.WebFilterChain;
import reactor.core.publisher.Mono;
@pgilad
pgilad / Constants.java
Last active Dec 26, 2018
An example of a pre-set scheduler for paralleling reactive work
View Constants.java
public static final Scheduler scheduler = Schedulers.fromExecutorService(new ThreadPoolExecutor(4, 10, 60, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>()))
@pgilad
pgilad / test.php
Created Oct 24, 2018
Php instance property mutation
View test.php
<?php
class State {
public $foo = 0;
}
class Mutator {
public function mutateState(State $state) {
$state->foo = 4;
}
@yoavweiss
yoavweiss / Remap_esc_key.sh
Created Oct 7, 2018
Remap § to Esc and Esc to F24
View Remap_esc_key.sh
#!/bin/bash
hidutil property --set '{"UserKeyMapping":[{"HIDKeyboardModifierMappingSrc":0x700000064,"HIDKeyboardModifierMappingDst":0x700000029}, {"HIDKeyboardModifierMappingSrc":0x700000029,"HIDKeyboardModifierMappingDst":0x700000073}]}'
You can’t perform that action at this time.