Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View steklopod's full-sized avatar
🎯
spot on

Dima Kaltovich steklopod

🎯
spot on
  • Berlin, Germany
View GitHub Profile
@masudcsesust04
masudcsesust04 / sdk-command-not-found.md
Created January 22, 2018 12:32
Fix sdk command not found after installing SDKMAN

Fix sdk command not found after installing SDKMAN.

You need to install following packages before installing sdkman:

sudo apt-get install unzip
sudo apt-get install zip
sudo apt-get install sed

Uninstall skdman if you installed already:

@petarnikolovski
petarnikolovski / http-get-dos.conf
Last active July 13, 2021 09:44
Fail2ban Configuration
# Fail2Ban configuration file
#
# NOTE
# You should set up in the jail.conf file, the maxretry and findtime carefully in order to avoid false positives.
#
# Author: http://www.go2linux.org
# Modified by: samnicholls.net
# * Mon 6 Jun 2016 - Updated failregex to capture HOST group correctly
[Definition]
@martinrisseeuw
martinrisseeuw / correct.vue
Last active June 2, 2020 04:35
Mapbox Nuxt component
<template>
<div id="map" class="map">
<div class="button-bar">
<button v-on:click="addMapLayer()">terrain</button>
</div>
</div>
</template>
<script>
@appikonda
appikonda / KillProcces.md
Last active November 27, 2019 19:18
Address already in use: JVM_Bind <null>:8080

###Exception:

Caused by: java.net.BindException: Address already in use: JVM_Bind <null>:8080
        at org.apache.tomcat.util.net.JIoEndpoint.bind(JIoEndpoint.java:407)
        at org.apache.tomcat.util.net.AbstractEndpoint.init(AbstractEndpoint.java:623)
        at org.apache.coyote.AbstractProtocol.init(AbstractProtocol.java:434)
        at org.apache.coyote.http11.AbstractHttp11JsseProtocol.init(AbstractHttp11JsseProtocol.java:119)
        at org.apache.catalina.connector.Connector.initInternal(Connector.java:981)
        ... 31 more
@m-x-k
m-x-k / PostJacksonObjectViaRestTemplate.java
Created October 19, 2016 13:44
Post Jackson Object Via Rest Template
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.http.*;
import org.springframework.web.client.RestTemplate;
class PostJacksonObjectViaRestTemplate {
public static void main(String[] args) throws Exception {
String url = "http://localhost:8080/example/";
HttpHeaders headers = new HttpHeaders();
@gunjanpatel
gunjanpatel / revert-a-commit.md
Last active April 21, 2024 22:10
Git HowTo: revert a commit already pushed to a remote repository

Revert the full commit

Sometimes you may want to undo a whole commit with all changes. Instead of going through all the changes manually, you can simply tell git to revert a commit, which does not even have to be the last one. Reverting a commit means to create a new commit that undoes all changes that were made in the bad commit. Just like above, the bad commit remains there, but it no longer affects the the current master and any future commits on top of it.

git revert {commit_id}

About History Rewriting

Delete the last commit

Deleting the last commit is the easiest case. Let's say we have a remote origin with branch master that currently points to commit dd61ab32. We want to remove the top commit. Translated to git terminology, we want to force the master branch of the origin remote repository to the parent of dd61ab32:

@lttlrck
lttlrck / gist:9628955
Created March 18, 2014 20:34
rename git branch locally and remotely
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
@matsev
matsev / CustomResponseEntityExceptionHandler.java
Last active January 16, 2023 06:04
Generic response error handling using @ControllerAdvice
@ControllerAdvice
public class CustomResponseEntityExceptionHandler extends ResponseEntityExceptionHandler {
@Override
protected ResponseEntity<Object> handleMethodArgumentNotValid(MethodArgumentNotValidException ex, HttpHeaders headers, HttpStatus status, WebRequest request) {
List<FieldError> fieldErrors = ex.getBindingResult().getFieldErrors();
List<ObjectError> globalErrors = ex.getBindingResult().getGlobalErrors();
List<String> errors = new ArrayList<>(fieldErrors.size() + globalErrors.size());
String error;
for (FieldError fieldError : fieldErrors) {
@stevenhaddox
stevenhaddox / server_certificates_to_pem.md
Last active December 14, 2023 05:42
Convert .crt & .key files into .pem file for HTTParty

Two ways to do it, but only worked for me so I'll put it first and the second for reference:

$ openssl pkcs12 -export -in hostname.crt -inkey hostname.key -out hostname.p12
$ openssl pkcs12 -in hostname.p12 -nodes -out hostname.pem

Other options for this method in comments below:

# Note, the -certfile root.crt appends all CA certs to the export, I've never needed these so it's optional for my personal steps
$ openssl pkcs12 -export -in hostname.crt -inkey hostname.key -certfile root.crt -out hostname.p12

Note, I've always had my hostname.crt as part of my .pem, so I keep my certs but apparently you may not have to, hence the nocerts flag being an extra option in this sample