Skip to content

Instantly share code, notes, and snippets.

View michael-o's full-sized avatar

Michael Osipov michael-o

  • Innomotics (A Siemens Business)
  • Berlin, Germany
  • 10:05 (UTC +02:00)
View GitHub Profile
@dant3
dant3 / mvncolor.sh
Last active January 9, 2017 04:57 — forked from katta/mvncolor.sh
#!/usr/bin/env bash
# Formatting constants
BOLD=`tput bold`
UNDERLINE_ON=`tput smul`
UNDERLINE_OFF=`tput rmul`
TEXT_BLACK=`tput setaf 0`
TEXT_RED=`tput setaf 1`
TEXT_GREEN=`tput setaf 2`
TEXT_YELLOW=`tput setaf 3`
@ayosec
ayosec / LibC.java
Created December 24, 2011 01:41
LibC binding with JNA
package com.ayosec.misc;
import com.sun.jna.*;
public class LibC {
public interface Handle extends Library {
Handle module = (Handle) Native.loadLibrary("c", Handle.class);
int getpid();
@MihailJP
MihailJP / test2038.c
Created October 8, 2012 15:04
Check if your time_t implementation will work after 2038
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
int main () {
time_t time_num[5] = {(time_t)0x00000000, (time_t)0x7fffffff, (time_t)0x80000000, (time_t)0xffffffff,};
struct tm* parsed_time; unsigned int i;
printf("sizeof(time_t) is %d.\n", sizeof(time_t));
for (i = 0; i < 4; i++) {
parsed_time = gmtime(&(time_num[i]));
@jvanzyl
jvanzyl / gist:16da25976f8ad27293fa
Last active July 3, 2018 17:50
Validate a Maven Core Pull Request
#!/bin/sh
#
# PR validator: This script will checkout Maven, apply a PR, build the Maven distribution and
# run the Maven integration tests against the just-built distribution. If you
# successfully get to the end of this script then your PR is ready to be reviewed.
# Assumptions:
# 1) You have a functioning version of Maven installed (script tested with 3.2.1)
# 2) You have a decent connection. This script checks out everything from scratch and downloads
# everything into a clean local repository. Not terribly efficient but makes sure there is no
@julianxhokaxhiu
julianxhokaxhiu / java.sh
Last active July 21, 2021 20:08
How to pass system properties with spaces in Java within your Bash scripts
#!/usr/bin/env bash
######################################################################################################################
# This script is a solution of when you want to pass Java options when they do come to the script as environment
# variable, or when you declare them inside a variable, using quotes. When you do so, you may obtain from the Java
# process an error that looks like this:
#
# $ ./java.sh
# Error: Could not find or load main class ...
#
package systextil.commons.io.path;
import java.io.File;
import com.sun.jna.Library;
import com.sun.jna.Native;
import com.sun.jna.NativeMapped;
import com.sun.jna.PointerType;
import com.sun.jna.win32.W32APIOptions;
@davisford
davisford / gist:5039064
Last active February 9, 2022 13:39
git clone into non-empty directory

Let's say you start a project locally, and do some editing.

$ mkdir -p ~/git/foo && cd ~/git/foo
$ touch NEWFILE

Now you decide you want to create a new github repo and track it, but the directory is non-empty so git won't let you clone into it. You can fix this, thusly:

@moisseev
moisseev / Postfix-SASL-client.md
Last active October 28, 2022 09:15
Replacing the default FreeBSD system mailer Sendmail with Postfix using SMTP AUTH, acting as mail client

Replacing the default FreeBSD system mailer Sendmail with Postfix using SMTP AUTH, acting as mail client

Replacing Sendmail with Postfix

# pkg install postfix-sasl1

Would you like to activate Postfix in /etc/mail/mailer.conf [n]? y2

# service sendmail stop

@darbyluv2code
darbyluv2code / web.xml
Created February 24, 2019 20:23
web.xml for servlet 4 (requires Tomcat 9)
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="4.0" xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd">
</web-app>
@kvelakur
kvelakur / uuidv4.md
Last active April 9, 2023 04:38
Generating a Version 4 UUID using OpenSSL

Generating a Version 4 UUID using OpenSSL

A simple function that uses OpenSSL's RAND_bytes function to generate a Version 4 UUID.