Skip to content

Instantly share code, notes, and snippets.

View bdelacretaz's full-sized avatar

Bertrand Delacretaz bdelacretaz

View GitHub Profile
@bdelacretaz
bdelacretaz / 90rc1rc1-binaries.txt
Created May 23, 2018 13:01
analysis of binary files for NetBeans 9.0 rc1-rc1 release
$ find . -type f | grep -v ' ' | while read f ; do file "$f" | egrep -v 'Java|XML|ASCII|PNG|JPEG|GIF|Unicode text'; done
./ide/launcher/macosx/NetBeansLauncher/netbeans.icns: Mac OS X icon, 168443 bytes, "ic09" type
./ide/launcher/macosx/NetBeansLauncher/English.lproj/MainMenu.nib/objects.nib: NeXT/Apple typedstream data, big endian, version 4, system 1000
./ide/launcher/macosx/NetBeansLauncher/ReadMe.rtf: Rich Text Format data, version 1, Apple Macintosh
./ide/launcher/windows/netbeans.ico: MS Windows icon resource - 5 icons, 16x16, 32 bits/pixel, 32x32, 32 bits/pixel
./projectimport.eclipse.core/test/unit/data/myeclipselibstest.zip: Zip archive data, at least v1.0 to extract
./css.editor/test/unit/data/testfiles/testHtmlApplication/public_html/folder/style2.css: empty
./css.editor/test/unit/data/testfiles/testHtmlApplication/public_html/style.css: empty
./lib.profiler/test/unit/src/org/netbeans/lib/profiler/heap/heapDumpLog.txt: data
./jellytools.ide/test/qa-functional/data/SampleProject/src/sample1/unrecog
@bdelacretaz
bdelacretaz / rc3bin.txt
Created July 13, 2018 12:28
Checking binaries in NetBeans 9.0 vc3 release
$ find . -type f | grep -v ' ' | while read f ; do file "$f" | egrep -v 'Java|XML|ASCII|PNG|JPEG|GIF|Unicode text'; done
./ide/launcher/macosx/NetBeansLauncher/netbeans.icns: Mac OS X icon, 168443 bytes, "ic09" type
./ide/launcher/macosx/NetBeansLauncher/English.lproj/MainMenu.nib/objects.nib: NeXT/Apple typedstream data, big endian, version 4, system 1000
./ide/launcher/macosx/NetBeansLauncher/ReadMe.rtf: Rich Text Format data, version 1, Apple Macintosh
./ide/launcher/windows/netbeans.ico: MS Windows icon resource - 5 icons, 16x16, 32 bits/pixel, 32x32, 32 bits/pixel
./projectimport.eclipse.core/test/unit/data/myeclipselibstest.zip: Zip archive data, at least v1.0 to extract
./css.editor/test/unit/data/testfiles/testHtmlApplication/public_html/folder/style2.css: empty
./css.editor/test/unit/data/testfiles/testHtmlApplication/public_html/style.css: empty
./lib.profiler/test/unit/src/org/netbeans/lib/profiler/heap/heapDumpLog.txt: data
./jellytools.ide/test/qa-functional/data/SampleProject/src/sample1/unrecog
@bdelacretaz
bdelacretaz / car.js
Last active February 13, 2019 17:41
// OpenWhisk minimal integration Web function example
// Get a car's make from the Icelandic apis.is service
// See https://github.com/apache/incubator-openwhisk/blob/master/docs/webactions.md
//
// Test as follows, on an OpenWhisk setup:
// $ wsk -i action create car car.js --web true
// ok: created action car
// $ export URL=$(wsk -i action get car --url | grep http)
// # Known good prefixes: aa02*, aa03*, aa12*
// $ export prefix=aa12

Measuring Docker image time to first request

This is a just rough method with rough results...

cat ctest.bash 
URL=http://localhost:8080
while true
do
  curl $URL 2>/dev/null || continue

echo

@bdelacretaz
bdelacretaz / Dockerfile.systemd-socket-activate
Created July 5, 2019 11:09
Testing systemd-socket-activate
# Example Dockerfile which uses systemd-socket-activate
# to start an executable when a socket connection is made.
FROM ubuntu:bionic
RUN apt-get update
RUN apt-get install -y systemd
EXPOSE 8080
CMD ["systemd-socket-activate", "-l 8080", "--inetd", "-a", "date"]
@bdelacretaz
bdelacretaz / runsync.sh
Last active July 9, 2019 11:47
Restart multiple shell commands synchronously (example)
#!/bin/bash
# Run two video players more or less in sync
# assuming they start playing immediately and
# exit when done playing
while true
do
# Start all players in the background
@bdelacretaz
bdelacretaz / play.scpt
Last active July 9, 2019 12:03
AppleScript: play video full screen, wait and exit
--- run this with osascript
set unixFile to "/somepath/movie2.mov"
set macFile to POSIX file unixFile
set fileRef to (macFile as alias)
tell application "QuickTime Player"
activate
set movie to open fileRef
set the looping of movie to false
set the presenting of movie to true
// Example capturing a 1200 x 6000 pixels screenshot
// from a website using https://github.com/microsoft/playwright
const pw = require('playwright');
(async () => {
const browser = await pw.firefox.launch(); // or 'chromium', 'firefox'
const context = await browser.newContext();
const page = await context.newPage();
await page.goto('https://lecourrier.ch/');
#!/bin/bash
# List all versions of Sling modules from a Maven repository
# ..just a ugly hack, we should use more solid parsing, or the Maven repository API
#
BASE_URL="https://repo1.maven.org/maven2/org/apache/sling/"
EGREP_FILTER=
curl -s $BASE_URL | grep 'a href' | egrep -v '\.\./|maven-metadata' | cut -d'"' -f2 | while read mod
do
curl -s ${BASE_URL}${mod} | grep 'a href' | egrep -v '\.\./|maven-metadata' | while read line
do
@bdelacretaz
bdelacretaz / VerifyLegalFilesMojo.java
Created May 5, 2020 17:10
VerifyLegalFilesMojo.java from the Apache Geronimo tools-maven-plugin-1.4-sources.jar
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0