Skip to content

Instantly share code, notes, and snippets.

View banan314's full-sized avatar
🏠
Working from home

Kamil Łopuszański banan314

🏠
Working from home
View GitHub Profile
@banan314
banan314 / ArraySumCalculator.java
Created March 10, 2024 17:42
Divide and conquer summing of an array using Java fork/join
import java.util.concurrent.RecursiveTask;
public class ArraySumCalculator extends RecursiveTask<Long> {
private static final int THRESHOLD = 1000; // Threshold for splitting the array
private final int[] array;
private final int start;
private final int end;
public ArraySumCalculator(int[] array, int start, int end) {
this.array = array;
@banan314
banan314 / VideoConference.java
Created January 22, 2024 04:26
Example usage of CountDownLatch
import java.util.concurrent.CountDownLatch;
import java.util.Random;
import java.util.logging.Level;
import java.util.logging.Logger;
class Participant implements Runnable {
private final CountDownLatch latch;
private final Random random = new Random();
private long id;
private static final Logger LOGGER = Logger.getLogger(Participant.class.getName());
@banan314
banan314 / clearBalanceSheet.gs
Created November 11, 2023 20:59
Clear contents of the balance sheet cells filled with financial data from the last year
function sheetName() {
var spreedsheet = SpreadsheetApp.getActiveSpreadsheet();
const monthNames = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
const monthSheets = monthNames.map(name => spreedsheet.getSheetByName(name));
const COLUMN_START = 6;
const DAYS_COUNT = 31;
for(var i=0; i < monthSheets.length; i++) {
@banan314
banan314 / remove_duplicated_tags.py
Last active March 10, 2024 17:47
remove duplicated tags from Joplin
from api import get_api
import time
start_time = time.time()
api = get_api()
f = open('duplicates-logs.txt', 'w')
@banan314
banan314 / merge weeks.gs
Created November 6, 2022 20:03
Google Spreedsheets script merging and setting border to week days
function numberToLetter(number){
var temp = ""
var letter = "";
while (number > 0){
temp = (number - 1) % 26;
letter = String.fromCharCode(temp + 65) + letter;
number = (number - temp - 1) / 26;
}
return letter;
}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
class Docking:
"""
Implementacje:
* oddt.docking.autodock_vina
* custom engine }
* oddt.docking.rdock } nowe klasy
"""
def set_protein(self, protein): pass
def set_writer(self, writer): # writer of type MolWriter
#!/usr/bin/env bash
rm -f mine/tests/*.out
for f in tests/*.in
do
./pol < $f > mine/$f
# do something on $f
done
cd mine/tests
@banan314
banan314 / 3dcurve.py
Created November 4, 2018 14:17
3D curve
import numpy as np
import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.gca(projection='3d')
theta = np.linspace(-4 * np.pi, 4 * np.pi, 100)
z = np.linspace(-2, 2, 100)
r = z**2 + 1
x = r * np.sin(theta)
y = r * np.cos(theta)
@banan314
banan314 / chmod public.sh
Created September 3, 2018 09:12
chmod so that others have all permissions to all files recursively
find . -type d -exec chmod 777 {} \;
find . -type f -exec chmod 666 {} \;
find . -type f -executable -exec chmod 777 {} \;