Skip to content

Instantly share code, notes, and snippets.

View alagiz's full-sized avatar

alagiz alagiz

  • Netherlands
View GitHub Profile
Questions are not from any actual exam!!!
Q: Create a job that calculates pi to 2000 decimal points using the container with the image named perl
and the following commands issued to the container: ["perl", "-Mbignum=bpi", "-wle", "print bpi(2000)"]
Once the job has completed, check the logs to and export the result to pi-result.txt.
Solution:
@msievers
msievers / [Spring, JMH] Howto integrate JMH benchmarks with Spring.md
Last active February 24, 2025 04:23
[Spring, JMH] Howto integrate JMH benchmarks with Spring

Motivation

Integrate JMH (Java Microbenchmarking Harness) with Spring (Boot) and make developing and running benchmarks as easy and convinent as writing tests.

Idea

Wrap the necessary JMH boilerplate code within JUnit to benefit from all the existing test infrastructure Spring (Boot) provides. It should be as easy and convinent to write benchmarks as it is to write tests.

TL;DR;

@gmaslowski
gmaslowski / cassandra-node2pod.yml
Last active July 18, 2024 14:23
k8s-cassandra-nodeLabel2pod
---
apiVersion: v1
kind: ConfigMap
metadata:
name: cassandra-rackdc
data:
cassandra-rackdc.properties: |
dc= datacenter
rack= RACK
---
@so0k
so0k / kubectl.md
Last active February 4, 2025 17:16
Playing with kubectl output

Kubectl output options

Let's look at some basic kubectl output options.

Our intention is to list nodes (with their AWS InstanceId) and Pods (sorted by node).

We can start with:

kubectl get no
# TODO use in house docker images for compilers
FROM ricejasonf/clang
WORKDIR /usr/local/src
# asio
RUN git clone https://github.com/chriskohlhoff/asio.git \
&& cd asio/asio \
&& ./autogen.sh \
&& ./configure --prefix=/usr/local --without-boost \
CXXFLAGS="-stdlib=libc++" LDFLAGS="-stdlib=libc++ -lc++abi" \
@sasq64
sasq64 / callback.cpp
Last active April 5, 2021 14:27
C++ Callbacks
#include <functional>
#include <vector>
#include <memory>
template<typename... X> struct Callback;
template <typename R, typename ...ARGS> struct Callback<R(ARGS...)>
{
struct BaseFx
{
virtual R call(ARGS...) = 0;
@destan
destan / ParseRSAKeys.java
Last active March 31, 2025 23:14
Parse RSA public and private key pair from string in Java
import java.io.IOException;
import java.net.URISyntaxException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.security.KeyFactory;
import java.security.NoSuchAlgorithmException;
import java.security.PrivateKey;
import java.security.interfaces.RSAPublicKey;
import java.security.spec.InvalidKeySpecException;
import java.security.spec.PKCS8EncodedKeySpec;
@scturtle
scturtle / translate.py
Last active January 8, 2020 08:38
google translate cli
#!/usr/bin/env python
# from pprint import pprint
try:
import urllib2 as request
from urllib import quote
except:
from urllib import request
from urllib.parse import quote
@vollmerm
vollmerm / nqueens.hs
Last active August 1, 2022 18:52
N-Queens: An example of backtracking search and constraint propagation in Haskell
-- nqueens.hs
-- Mike Vollmer, 2014
--
-- A simple and reasonably efficient solution to the N-Queens problem using backtracking
-- and constraint propagation.
--
-- The program takes one command line parameter: the size (N) of the board.
-- For example:
--
-- ./nqueens 8