Skip to content

Instantly share code, notes, and snippets.

View slachiewicz's full-sized avatar

Sylwester Lachiewicz slachiewicz

View GitHub Profile
@slachiewicz
slachiewicz / jira_oauth.go
Created August 27, 2022 22:11 — forked from Lupus/jira_oauth.go
Example of using OAuth authentication with JIRA in Go
/*
To the extent possible under law, Konstantin Olkhovskiy has waived
all copyright and related or neighboring rights to this snippet.
CC0 license: http://creativecommons.org/publicdomain/zero/1.0/
*/
package main
import (
"crypto/x509"
@slachiewicz
slachiewicz / build-protoc.sh
Created May 10, 2022 10:36 — forked from syhily/build-protoc.sh
Build protoc.exe for Apple M1
#!/bin/bash
# Builds protoc executable into target/<OS>/<ARCH>/protoc.exe; optionally builds
# protoc plugins into target/<OS>/<ARCH>/protoc-gen-*.exe
#
# Usage: ./build-protoc.sh <OS> <ARCH> <TARGET>
#
# <TARGET> can be "protoc" or "protoc-gen-javalite". Supported <OS> <ARCH>
# combinations:
# HOST <OS> <ARCH> <COMMENT>
@slachiewicz
slachiewicz / metadata.sh
Created August 29, 2021 17:53 — forked from atheiman/metadata.sh
EC2 Metadata API basics
# https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html
METADATA_TOKEN="$(curl -s -X PUT 'http://169.254.169.254/latest/api/token' -H 'X-aws-ec2-metadata-token-ttl-seconds: 21600')"
AVAILABILITY_ZONE="$(curl -s -H "X-aws-ec2-metadata-token: $METADATA_TOKEN" http://169.254.169.254/latest/meta-data/placement/availability-zone)"
export AWS_REGION="$(echo "$AVAILABILITY_ZONE" | rev | cut -c 2- | rev)"
export AWS_DEFAULT_REGION="$AWS_REGION"
export INSTANCE_ID="$(curl -s -H "X-aws-ec2-metadata-token: $METADATA_TOKEN" http://169.254.169.254/latest/meta-data/instance-id)"
# Instance identity documents is another very useful interface with many key value pairs in json format
# https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-identity-documents.html
@slachiewicz
slachiewicz / export-files-job.yaml
Created August 29, 2021 17:52 — forked from atheiman/export-files-job.yaml
Generate job artifacts in an initContainer and export the files to workstation afterwards.
# Allows copying of job files to local after execution. Example copy command:
#
# kubectl apply -f ./export-file-job.yaml
# POD=$(kubectl get pod --selector=job-name=export-files -o jsonpath='{.items[0].metadata.name}')
# kubectl wait pod/$POD --for=condition=ready
# until kubectl logs $POD | grep 'Ready for download'; do sleep 2; done
# kubectl cp $POD:files.zip ./job-files-$(date +"%Y%m%d%H%M").zip
#
# Another option would be for the `export-files` container to be a webserver to
# serve of the artifact files to be downloaded with `kubectl port-forward ...`.
@slachiewicz
slachiewicz / SpringTaskExecutor.java
Created April 19, 2021 19:53 — forked from mguilherme/SpringTaskExecutor.java
Start 5 tasks and wait until they finish (Spring AsyncTaskExecutor)
package com.guilherme.miguel;
import io.vavr.control.Try;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.core.task.AsyncTaskExecutor;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
@slachiewicz
slachiewicz / setup.md
Created January 10, 2021 00:55 — forked from rinarakaki/setup.md
Set up dev environment based on Ubuntu 20.10

.bash_profile

export LC_ALL=C.UTF-8
export LANG=C.UTF-8

export CC=clang-11
export CXX=clang++-11

export PATH=/usr/lib/linux-tools-4.15.0-66:$PATH
@slachiewicz
slachiewicz / windows_hardening.cmd
Created May 10, 2020 11:10 — forked from mackwage/windows_hardening.cmd
Script to perform some hardening of Windows OS
:: Windows 10 Hardening Script
:: This is based mostly on my own personal research and testing. My objective is to secure/harden Windows 10 as much as possible while not impacting usability at all. (Think being able to run on this computer's of family members so secure them but not increase the chances of them having to call you to troubleshoot something related to it later on). References for virtually all settings can be found at the bottom. Just before the references section, you will always find several security settings commented out as they could lead to compatibility issues in common consumer setups but they're worth considering.
:: Thank you @jaredhaight for the Win Firewall config recommendations!
:: Thank you @ricardojba for the DLL Safe Order Search reg key!
:: Best script I've found for Debloating Windows 10: https://github.com/Sycnex/Windows10Debloater
::
::#######################################################################
::
:: Change file associations to protect against common ransomware

Keybase proof

I hereby claim:

  • I am slachiewicz on github.
  • I am slachiewicz (https://keybase.io/slachiewicz) on keybase.
  • I have a public key ASBl8NimUbKIctTlePSoE9y-Hv4LQYDqP6ccLp7wpiZ9Xwo

To claim this, I am signing this object:

pkill -9 gpg-agent
source <(gpg-agent --daemon)
2020-04-01 21:14:54,418 [ 64084] ERROR - #org.jetbrains.idea.maven - IntelliJ IDEA 2019.3.4 Build #IU-193.6911.18
2020-04-01 21:14:54,419 [ 64085] ERROR - #org.jetbrains.idea.maven - JDK: 11.0.6; VM: OpenJDK 64-Bit Server VM; Vendor: JetBrains s.r.o
2020-04-01 21:14:54,419 [ 64085] ERROR - #org.jetbrains.idea.maven - OS: Windows 10
2020-04-01 21:14:54,422 [ 64088] ERROR - #org.jetbrains.idea.maven - Last Action: Maven.ReimportProject
2020-04-01 21:14:56,501 [ 66167] INFO - j.ide.actions.RevealFileAction -
Exit code 1
2020-04-01 21:14:57,703 [ 67369] INFO - rationStore.ComponentStoreImpl - Saving appFileTypeManager took 16 ms, ProjectJdkTable took 15 ms
2020-04-01 21:14:57,788 [ 67454] INFO - rationStore.ComponentStoreImpl - Saving Project (name=maven, containerState=ACTIVE, componentStore=C:\projects\maven-sources\core\maven) ProjectPlainTextFileTypeManager took 15 ms, libraryTable took 16 ms
2020-04-01 21:15:52,073 [ 121739] INFO - j.ide.actions.RevealFileActio