Skip to content

Instantly share code, notes, and snippets.

View anton-x-t's full-sized avatar

Anton Thelander anton-x-t

  • Uppsala, Sweden
View GitHub Profile
@anton-x-t
anton-x-t / mongodb-bulk-rename.mongosh.js
Created May 3, 2024 17:26
MongoDB Bulk Rename mongosh js
// MIT License
// Sources below!!! Thank you persons and entities for your code!!!
db.product.find({"fieldOne":"findString"}).forEach(doc => {
let updatedFieldOne = doc.fieldOne.replace('findString', 'replaceString');
print(doc._id)
print(doc.fieldOne)
print(updatedFieldOne)
db.product.updateOne(
@anton-x-t
anton-x-t / mongodb-import-slowly.ps1
Last active May 3, 2024 10:03
MongoDB Import Slowly PowerShell Script
# MIT Licence
# MongoDB Import Slowly PowerShell Script
# Sources below!!! Thank you all persons and entities!!!
$i = 0
$lines = Get-Content .\data.json
$lineCount = ($lines | Measure-Object -line).lines
Write-Output "Starting import of $lineCount lines."
@anton-x-t
anton-x-t / gradle_properties_bump_minor_version.sh
Last active October 26, 2023 14:28
gradle_properties_bump_minor_version.sh
#!/bin/bash
# Copyright 2023 Anton Thelander
# License: MIT
gradle_properties_file=gradle.properties
original_complete_row=$(grep -E "version=.+\..+\..+" $gradle_properties_file)
before_minor_v=$(echo $original_complete_row | cut -f1 -d".")
original_minor_v=$(echo $original_complete_row | cut -f2 -d".")
after_minor_v=$(echo $original_complete_row | cut -f3 -d".")
bumped_minor_v=$((original_minor_v+1))
@anton-x-t
anton-x-t / docker-logs-localtime
Last active August 3, 2023 07:37 — forked from popstas/docker-logs-localtime
docker-logs-localtime - Replace all UTC dates in docker logs output to local dates in pipe
#!/usr/bin/env node
/*
* replace all UTC dates to local datetime with timezone offset through pipe
* usage: docker logs -ft container_name | docker-logs-localtime
*
* Credits:
*
* docker-logs-localtime,
* thank you anton-x-t,
* https://gist.github.com/anton-x-t/859a69d0426ed1e4040660f57229c76c
@anton-x-t
anton-x-t / run_your_procedure.sql
Created October 11, 2018 11:45
oracle run or execute your procedure
begin
-- License for this code: cc by-sa 3.0
-- On executing procedure, thank you Thorsten, https://stackoverflow.com/q/1854427
your_procedure;
end;
@anton-x-t
anton-x-t / your_table_name_dc_proc.sql
Last active October 11, 2018 11:40
oracle procedure to create table without knowing if table exists or not, tested in Oracle Database 11g
create or replace procedure your_table_name_dc_proc is
-- In the procedure name, dc is short for drop and create.
-- On getting advices and tips, thank you very much StackOverflow, stackoverflow.com
-- License for this code: cc by-sa 3.0
table_name varchar2(50);
procedure drop_table(table_name in varchar2) is
begin
-- On dropping a table not knowing if the table exists or not, thank you Jeffrey Kemp, https://stackoverflow.com/q/1799128
@anton-x-t
anton-x-t / gist:43a298607937c46bbdf9e102ddeec332
Last active October 2, 2018 13:19 — forked from javajack/gist:04422d5a95d8e8dae1aa
SOAP JAX WS Password Digest Nonce Date Created Handler generator
// Thank you very much eogiles for earlier written code, credit goes to you.
// Thank you very much javajack for earlier written code, credit goes to you.
// License for this code: cc by-sa 3.0
// Please get Maven in order for this code to work.
// Please get your own imports, you'll probably have to get commons-codec manually by adding it to your POM in Maven:
// <!-- https://mvnrepository.com/artifact/commons-codec/commons-codec
// To be able to convert to Base64 when making the PasswordDigest token. -->
// <dependency>