Skip to content

Instantly share code, notes, and snippets.

View SylvainMarty's full-sized avatar
👨‍💻
Hacking around

Sylvain Marty SylvainMarty

👨‍💻
Hacking around
View GitHub Profile
@SylvainMarty
SylvainMarty / command.sh
Created June 1, 2022 08:40
Get the 20 biggest files on a linux system
#!/bin/bash
sudo du -ah / 2>/dev/null | sort -rh | head -n 20
@SylvainMarty
SylvainMarty / 0_GENERATE_PHP_SDK_FROM_OPENAPI.md
Last active March 25, 2021 16:33
Generate PHP SDK from OpenAPI with Docker

1) Create the home folder of the future SDK

2) Copy the config.yml file into the SDK folder

3) Update the value of invokerPackage to match the SDK namespace

3) Download the generate_openapi_php_sdk.sh script at the root of your project

3) Generate SDK for specific OpenAPI URL with this snippet

@SylvainMarty
SylvainMarty / nodejs-get-local-ips.js
Created May 20, 2019 19:45
Cross platform alternative to ip package in NodeJS : get all public local IPs
import os from 'os'
let ifaces = os.networkInterfaces()
let ips = {}
// From this thread : https://stackoverflow.com/questions/3653065/get-local-ip-address-in-node-js?answertab=active#tab-top
Object.keys(ifaces).forEach(function (ifname) {
let alias = 0
ifaces[ifname].forEach(function (iface) {
if (iface.family !== 'IPv4' || iface.internal !== false) {
@SylvainMarty
SylvainMarty / setup-k8-local.sh
Last active February 18, 2018 16:27
Script to setup Kubernetes Minikube cluster locally (and kompose)
#!/bin/bash
# CHANGE ME
DISTRO_NAME="artful"
sudo true
# Virtual Box Hypervisor driver
sudo add-apt-repository "deb https://download.virtualbox.org/virtualbox/debian ${DISTRO_NAME} contrib"
wget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | sudo apt-key add -
@SylvainMarty
SylvainMarty / spring-enable-history-mode.md
Created December 3, 2017 09:21
Code snippet to enable "HTML5 history mode" in Spring MVC

Spring MVC - Enable HTML5 history mode

This snippet shows how to authorize HTML5 history mode used by Javascript frameworks like Angular or VueJS.

There is two simple steps :

  • Create the filter
  • Register it in your project configuration

Create the filter

Create the file HistoryModeFilter.java with the following content :