Skip to content

Instantly share code, notes, and snippets.

@edwint88
edwint88 / php-cs-fixer-hg.sh
Last active November 14, 2017 14:31
Using PHP CS Fixer on CI with Mercurial
#!/bin/bash
CHANGED_FILES=$(hg status -m -a -n | grep "**.php$" | grep -v "vendor");
printf "Files to be checked:\n\n";
echo "$CHANGED_FILES";
printf "\n"
if [[ -n "$CHANGED_FILES" ]]
then
EXTRA_ARGS=('--' ${CHANGED_FILES[@]});
@edwint88
edwint88 / php-cs-fixer-hg.cmd
Created November 14, 2017 14:37
Using PHP CS Fixer on CI with Mercurial (on Windows)
@echo off
ECHO "Start php-cs-fixer"
setlocal EnableDelayedExpansion
set CHANGED_FILES=
for /f "tokens=*" %%i in ('hg st -m -a -n ^| FINDSTR /s .php' ^| FINDSTR /V vendor) do (
set "CHANGED_FILES=!CHANGED_FILES! %%i"
)
IF "%CHANGED_FILES%" NEQ "" (
ECHO "It has changed files that need to be checked!"
SET "EXTRA_ARGS=--%CHANGED_FILES%"
@edwint88
edwint88 / dockerfile.part
Created January 17, 2018 13:01
Install ssh on a docker container
# Install sshd
RUN apt-get update && apt-get install -y openssh-server
RUN mkdir /var/run/sshd
RUN sed -i 's/PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
# SSH login fix. Otherwise user is kicked off after login
RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd
ENV NOTVISIBLE "in users profile"
RUN echo "export VISIBLE=now" >> /etc/profile
EXPOSE 22
@edwint88
edwint88 / chocolatey-behind-proxy-install-cli.txt
Created January 31, 2018 13:16
How to install chocolatey behind a proxy
//in powershel
$client= ((New-Object System.Net.WebClient)); //https://msdn.microsoft.com/en-us/library/system.net.webclient(v=vs.110).aspx
$client.Proxy = ((New-Object System.Net.WebProxy("http://127.0.0.1:3128"))); //or set the credentials if you don't use cntlm
Set-ExecutionPolicy Bypass -Scope Process -Force; iex $client.DownloadString('https://chocolatey.org/install.ps1')
{
"realm": "demo",
"auth-server-url": "https://home.localdomain:8443/auth",
"ssl-required": "external",
"resource": "test", // this is client id
"public-client": true,
"truststore": "classpath:/keycloak.jks", //keycloak.jks is in src/main/resources/keycloak.jks
"truststore-password": "secret",
"client-keystore" : "/usr/demo/keycloakPub.jks", //keycloak.jks is on the server under /usr/demo/keycloak.jks
"client-keystore-password" : "secret",
true &>/dev/null </dev/tcp/127.0.0.1/$PORT && echo open || echo closed
@edwint88
edwint88 / cloudSettings
Last active May 20, 2020 09:48
Visual Studio Code Settings Sync Gist
{"lastUpload":"2020-05-20T09:48:34.306Z","extensionVersion":"v3.4.3"}
# Method: POST
# Headers
# Content-Type: application/x-www-form-urlencoded
# Authorization Basic encoded(client_id:secret)
# Body
# grant_type client_credentials
http://127.0.0.1:8088/auth/realms/app/protocol/openid-connect/token
# Method: POST
# Headers
# Authorization Bearer eyJhbGciO... (access token)
# Content-Type: application/json
# Body
# {
# "username": "test-user",
# "groups": ["Comp1"], // doesn't work, even if it is in the docs
# "lastName": "test",
@edwint88
edwint88 / ApplicationConfig.java
Created July 30, 2019 14:53 — forked from ivargrimstad/ApplicationConfig.java
Microservices in Java - Swarm example
@ApplicationPath("/")
public class ApplicationConfig extends Application {
@Override
public Set<Class<?>> getClasses() {
Set<Class<?>> resources = new HashSet<>();
resources.add(HelloResource.class);
return resources;
}
}