Skip to content

Instantly share code, notes, and snippets.

@nhtzr
nhtzr / Makefile
Last active May 20, 2019 16:16 — forked from xenogenesi/Makefile
create self signed certificates
DOMAIN ?= localhost
DAYS ?= 500
SAN_DOMAINS ?=
COUNTRY := IT
STATE := IT
COMPANY := Evil Corp.
# credits to: https://gist.github.com/fntlnz/cf14feb5a46b2eda428e000157447309
# Run through ct
systemd:
units:
- name: systemd-networked.service
enabled: true
- name: systemd-resolved.service
enabled: true
- name: docker-tcp.socket
enabled: true
from sys import argv
def process_email(email_raw_line):
email = email_raw_line.strip()
[user, domain] = email.split("@")
# Remove user plus suffix: + marks ignored section
plus_index = user.find("+")
user = user[:plus_index] if plus_index > -1 else user
from sys import argv
n = argv[1]
co_dividend = 0
dec_expansion = 0
pow_max = len(n) - 2 # Last iteration should be pow == 0, first it should be the highest
for (i,c) in enumerate(n[:-1]): # Ignore last digit
pow_i = pow_max - i
co_dividend += int(c) # Sum of all digits
#!/bin/bash
#Getting started
# install sudo
apt-get install sudo
# create new user
adduser alice
# add to sudo group
usermod -aG alice
# change accounts
@nhtzr
nhtzr / data.json
Created November 12, 2018 22:40
Approach for multi value retrieva in stream mode
{
"A": [
{
"B": {
"C": [
{
"D": {
"app": "Utility",
"date": "2018-10-01",
"applicationNumberText": {
tap "datawire/blackbird"
tap "hairyhenderson/tap"
tap "homebrew/bundle"
tap "homebrew/cask"
tap "homebrew/cask-fonts"
tap "homebrew/cask-versions"
tap "homebrew/core"
tap "homebrew/dupes"
tap "homebrew/services"
tap "homebrew/versions"
@nhtzr
nhtzr / Makefile
Last active July 16, 2018 21:47
How to self signed cert (java curl client auth) (remember to update vars with your desired host pass and paths)
KEYSTORE=keystore.jks
TRUSTSTORE=truststore.jks
PASSWORD=changeit
HOSTNAME=localhost
CLIENTNAME=client
# CN = Common Name
# OU = Organization Unit
# O = Organization Name
#contentArea {
position: inherit !important;
}
#rightCol {
display: none !important;
}
#pagelet_sidebar {
display: none !important;
package us.peopleconnect.microservicecore.util;
import java.io.IOException;
import java.io.Serializable;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Types;
import java.util.HashMap;
import java.util.Map;