Skip to content

Instantly share code, notes, and snippets.

View pettan93's full-sized avatar
🎯
Focusing

Petr Kalas pettan93

🎯
Focusing
View GitHub Profile
@pettan93
pettan93 / HierarchyParser.java
Created April 3, 2020 17:01
complexity of this algorithm?
public TreeNode parseHiearchy(List<OrganizationUnit> organizationUnits) {
HashMap<String, OrganizationUnit> divisions = new HashMap<>();
HashMap<String, List<OrganizationUnit>> departments = new HashMap<>();
HashMap<String, List<OrganizationUnit>> jobs = new HashMap<>();
for (OrganizationUnit organizationUnit : organizationUnits) {
switch (organizationUnit.getOrganizationUnitType()) {
case DIVISION: {
divisions.put(organizationUnit.getPrefix(), organizationUnit);
break;
@pettan93
pettan93 / put.sh
Created December 6, 2019 16:56
CURL | PUT content to Confluence using REST API
curl -v -X PUT -u user:pass -H "Content-Type: application/json; charset=UTF-8" -d "{\"id\":\"111673413\",\"type\":\"page\",\"title\":\"ASD2\",\"space\":{\"key\":\"FP\"},\"body\":{\"storage\":{\"value\":\"hello\",\"representation\":\"storage\"}},\"version\":{\"number\":\"2\"}}" https://confluence.company.cz/rest/api/content/111673413
@pettan93
pettan93 / gist:9a7c3bb3ed3b5899b35ead7ed4da645a
Last active December 16, 2019 20:16
Docker (on Windows) - Run MSSQL2017
docker run --privileged --name sqlserver2017 -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=SomeComplexEnoughtPW2019!" -p 1433:1433 mcr.microsoft.com/mssql/server:2017-latest
// password needs to be complex enought
// its not working with env parameters in 'quotation marks', use "these"
@Component
@AllArgsConstructor
@Slf4j
public class TokenService {
private final TokenRepository tokenRepository;
private final TokenObtainer tokenObtainer;
public void refreshTokens() {
@pettan93
pettan93 / gist:723bd96bb89dfec524388958165ad730
Last active November 9, 2019 09:17
Execute SQL query in MSSQL using Docker, one-liner
docker run mcr.microsoft.com/mssql-tools sh -c "/opt/mssql-tools/bin/sqlcmd -S 127.0.0.1 -U user -P pass -Q 'select @@version;'"