Skip to content

Instantly share code, notes, and snippets.

View mjul's full-sized avatar

Martin Jul mjul

View GitHub Profile
@mjul
mjul / azure-list-app-settings.ps1
Created July 13, 2018 11:50
Azure: list application settings from PowerShell
$apiVersion = "2018-02-01"
$resourceGroup = "sandbox-martinj"
$rname = "sandbox-GraphQLApi";
Invoke-AzureRmResourceAction `
-ApiVersion $apiVersion `
-ResourceGroupName $resourceGroup `
-ResourceType "Microsoft.Web/sites/config/appsettings" `
-ResourceName $rname `
-Action list `
@mjul
mjul / docker-compose.yml
Created April 4, 2018 11:05
Elastic Search, Logstash and Kibana via docker-compose for parsing key=value style log files
version: '2'
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch-oss:6.2.2
volumes:
- esdata:/usr/share/elasticsearch/data
ports:
- "9200:9200"
@mjul
mjul / JustLogin.js
Created January 10, 2018 08:22
Selenium Javascript web-driver API with promises
var webdriver = require('selenium-webdriver'),
By = webdriver.By,
until = webdriver.until,
logging = webdriver.logging;
// Selenium's promise module provides logging to report every instance of unsynchronized code running through the promise manager
logging.installConsoleHandler();
logging.getLogger('promise.ControlFlow').setLevel(logging.Level.ALL);
@mjul
mjul / SeleniumScreenshot.js
Last active January 10, 2018 08:23
Take screenshot with Selenium JavaScript driver
var webdriver = require('selenium-webdriver'),
By = webdriver.By,
until = webdriver.until,
logging = webdriver.logging;
const fs = require('fs');
const path = require('path');
// Take a screenshot.
// state contains the Selenium driver instance and the config with the default path.
@mjul
mjul / build.xml
Created January 4, 2018 13:51
Ant macros for parametrized builds
<!-- use Ant macrodef for to simplify building similar WAR files for test and production -->
<macrodef name="build-war">
<attribute name="wartype" />
<sequential>
<mkdir dir="${dist}/@{wartype}"/>
<war warfile="${dist}/@{wartype}/${ant.project.name}.war" webxml="etc/web-@{wartype}.xml">
<classes dir="${path-to-classes}"/>
<mappedresources>
@mjul
mjul / .i18n
Created January 4, 2018 10:36
Set SSH Mac to Linux locale
export LC_ALL=da_DK.utf8
@mjul
mjul / Shell
Last active January 2, 2018 15:40
Check the signature of PyCharm if it keeps asking "accept incoming connections" (patches break it - delete and reinstall if sig broken)
codesign -vvv /Applications/PyCharm.app
@mjul
mjul / log.txt
Created October 18, 2016 07:43
F# interactive exposes a bug in Mono (OSX)
fsibug $ cat mini.fsx
type A = A of int
let result = [for a in 1..3 -> A a]
printfn "Succeeded: %A" result
fsibug $ fsharpi mini.fsx
System.TypeLoadException: Failure has occurred while loading a type.
at FSI_0001+result@2.GenerateNext (System.Collections.Generic.IEnumerable`1[FSI_0001+A]& next) [0x000a0] in <096c3b14bd5948a9921b6ca3f280fec3>:0
at Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1[T].MoveNextImpl () [0x00017] in <57dfe31ddff9fae1a74503831de3df57>:0
@mjul
mjul / 02_nginx_gzip_configuration.config
Last active November 6, 2020 03:29
Enable gzip compression in Elastic Beanstalk Docker nginx proxy (add to .ebextensions folder)
files:
"/etc/nginx/conf.d/gzip.conf":
mode: "644"
owner: "root"
group: "root"
content: |
# enable gzip compression
gzip on;
gzip_min_length 1100;
gzip_buffers 4 32k;
@mjul
mjul / rsync.md
Created August 19, 2016 10:06
RSync a local directory to docker-machine to make it available for VOLUME

Docker VOLUME directories are local directories on the docker host. Hence, when using docker-machine with remote hosts they are not available. However, we can rsync files to the remote docker host and MOUNT them from there

Local directory to docker-machine home directory

Assuming rs is a directory, this copies its contents to the home directory of the default user (ubuntu) on the remote docker-machine with the name my-sandbox. : denotes the remote machine, with no path it defaults to the current directory of the shell (the ubuntu user's home directory).