Skip to content

Instantly share code, notes, and snippets.

View slachiewicz's full-sized avatar

Sylwester Lachiewicz slachiewicz

View GitHub Profile
@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
@slachiewicz
slachiewicz / MyBenchmark.java
Created February 2, 2020 10:47 — forked from AdamStelmaszczyk/MyBenchmark.java
Should I use Java's String.format() if performance is important?
package org.sample;
import org.openjdk.jmh.annotations.*;
import org.openjdk.jmh.runner.Runner;
import org.openjdk.jmh.runner.RunnerException;
import org.openjdk.jmh.runner.options.Options;
import org.openjdk.jmh.runner.options.OptionsBuilder;
import java.util.concurrent.TimeUnit;
@slachiewicz
slachiewicz / haversine.scala
Created January 14, 2020 21:34 — forked from pavlov99/haversine.scala
Spherical distance calcualtion based on latitude and longitude with Apache Spark
// Based on following links:
// http://andrew.hedges.name/experiments/haversine/
// http://www.movable-type.co.uk/scripts/latlong.html
df
.withColumn("a", pow(sin(toRadians($"destination_latitude" - $"origin_latitude") / 2), 2) + cos(toRadians($"origin_latitude")) * cos(toRadians($"destination_latitude")) * pow(sin(toRadians($"destination_longitude" - $"origin_longitude") / 2), 2))
.withColumn("distance", atan2(sqrt($"a"), sqrt(-$"a" + 1)) * 2 * 6371)
>>>
+--------------+-------------------+-------------+----------------+---------------+----------------+--------------------+---------------------+--------------------+------------------+
|origin_airport|destination_airport| origin_city|destination_city|origin_latitude|origin_longitude|destination_latitude|destination_longitude| a| distance|
@slachiewicz
slachiewicz / forex-scrape.md
Created September 5, 2019 09:49 — forked from bretton/forex-scrape.md
Scraping Forex Data

Scraping Forex Data

I was looking for ways to scrape forex data after fixer.io switched to a subscription model with rate-limiting, making their API useless for lots of queries.

1. Use an alternative API

One alternative API which is still free is https://exchangeratesapi.io/

It's basically a drop-in replacement for fixer.io and can be used to get all forex rates in json format at

@slachiewicz
slachiewicz / README.md
Created April 5, 2019 22:14 — forked from leonardofed/README.md
A curated list of AWS resources to prepare for the AWS Certifications


A curated list of AWS resources to prepare for the AWS Certifications

A curated list of awesome AWS resources you need to prepare for the all 5 AWS Certifications. This gist will include: open source repos, blogs & blogposts, ebooks, PDF, whitepapers, video courses, free lecture, slides, sample test and many other resources.


Configuration Properties

Configuring your Service Provider through configuration properties is pretty straight forward and most configurations could be accomplished this way. The two limitations that exists are: You can only configure what is exposed as properties, obviously, and you cannot provide specific implementations or instances of the different Spring Security SAML classes/interfaces. If you need to provide custom implementations of certain types or a more dynamic configuration you'll need to use the Java DSL approach for that configuration, but as expressed before, you can configure as much as you can through properties, while using the DSL configuration for any dynamic or custom implementations configuration. You can mix the two flavors.
The following table shows all the available properties (Parsed from Spring Configuration Metadata file).

Key Default Value Description
saml.sso.default-failure-url /
@slachiewicz
slachiewicz / LocalTSA.java
Created June 28, 2018 23:22 — forked from Glamdring/LocalTSA.java
A local TSA
@Service
public class TimestampService {
private static final Logger logger = LoggerFactory.getLogger(TimestampService.class);
public static final AlgorithmIdentifier sha512oid = getSha512Oid();
private SecureRandom random = new SecureRandom();
@Value("${timestamp.keystore.path}")
private Resource keystorePath;