Skip to content

Instantly share code, notes, and snippets.

View tpiekarski's full-sized avatar
⌨️

Thomas Piekarski tpiekarski

⌨️
View GitHub Profile
@tpiekarski
tpiekarski / mounting-iso-images.sh
Created March 23, 2020 10:18
Mounting ISO Images
# Example how to mount an ISO image file
sudo mount -o loop <image.iso> <directory>
@tpiekarski
tpiekarski / Log.java
Created March 6, 2020 21:07
A mock for Log while running tests for Android
package android.util;
import java.util.Locale;
import static java.lang.System.out;
@SuppressWarnings("UnusedReturnValue")
public class Log {
private static final int DEFAULT_RETURN_VALUE = 0;
@tpiekarski
tpiekarski / selenide-live-screenshots.java
Created November 21, 2019 13:09
Live Screenshots of Selenide/Selenium inside IDEA
// For taking live screenshots in Selenide/Selenium Tests inside IDEAs Debugger watch that expression:
Screenshots.takeScreenShotAsImage($("*"))
@tpiekarski
tpiekarski / java-spring-access-mvc-responses.java
Created November 7, 2019 09:30
Accessing Responses from Spring MVC in Unit Tests
package ...;
import ...;
@ExtendWith(SpringExtension.class)
@WebMvcTest(controllers = SomeMVCController.class, secure = false)
class SomeMVCUnitTests {
@Autowired
private MockMvc mvc;
@tpiekarski
tpiekarski / express-exit-route.js
Created June 19, 2019 16:57
A HTTP-Route for exiting Node.js Server Process with Express
const express = require('express');
const app = express();
const port = 3000;
app.get('/exit', (req, res) => {
res.sendStatus(200);
res.on('finish', () => {
// Exiting process when the finish event was emited and the response was at least passed successfully to the operating system
// (for details see: https://nodejs.org/api/http.html#http_event_finish). Without that the HTTP status code 200 won't make it.
console.log(`Sent a 200, stoping to list for connections on ${port} and exiting process.`);
@tpiekarski
tpiekarski / tobii-stream-sdk.pri
Created August 25, 2018 07:44
Integration of Tobii Stream SDK into Qt Build Process
# Integration of Tobii Stream SDK into Qt Build Process
#
# Reference:
# http://doc.qt.io/qt-5/qmake-variable-reference.html#includepath
# http://doc.qt.io/qt-5/qmake-variable-reference.html#libs
# http://doc.qt.io/qt-5/qmake-test-function-reference.html#equals-variablename-value
# http://doc.qt.io/qt-5/qmake-language.html#replacing-values
#
# Environment Variable containing the path to Tobii Stream SDK
@jiahao
jiahao / nrules.svg
Last active May 17, 2022 08:30
What do .gitignore files tell us about the inherent complexity of programming languages? This gist can be run on data from GitHub's own collection of gitignore templates, whose repository is at https://github.com/github/gitignore, and counts how many rules are present in the template for each programming language.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@coryhouse
coryhouse / package.json
Last active April 26, 2024 13:01
Example of calling one script from another
{
"name": "npm-scripts-example",
"version": "1.0.0",
"description": "npm scripts example",
"scripts": {
"clean": "rimraf ./dist && mkdir dist",
"prebuild": "npm run clean",
"build": "cross-env NODE_ENV=production webpack"
}
}
@ipedrazas
ipedrazas / gist:6d6c31144636d586dcc3
Last active July 10, 2023 16:24
Nginx ssl config

The process starts by creating the CSR and the private key:

openssl req -nodes -newkey rsa:2048 -nodes -keyout dotmarks.net.key -out dotmarks.net.csr -subj "/C=GB/ST=London/L=London/O=dotmarks/OU=IT/CN=dotmarks.net"

Generates

  • dotmarks.net.key
  • dotmarks.net.csr