Skip to content

Instantly share code, notes, and snippets.

View timxor's full-sized avatar

Tim Siwula timxor

View GitHub Profile
@timxor
timxor / bidirectional_copy.java
Created November 23, 2025 08:28
Copy from both ends simultaneously toward the center.
// Bidirectional Copy (from both ends toward center)
// Used for reversing arrays or merging sorted arrays
// Processes from opposing ends simultaneously
public static void bidirectionalCopy(int[] src, int srcStart, int srcEnd,
int[] dest, int destStart, int destEnd) {
int left = srcStart;
int right = srcEnd;
int destLeft = destStart;
int destRight = destEnd;
@timxor
timxor / backward_copy.java
Created November 23, 2025 08:25
Backward copy processes right-to-left and handles overlapping ranges correctly by reading from the end first, ensuring source data isn't overwritten before being copied.
// Backward Copy (right-to-left)
// REQUIRED when source and destination ranges overlap
// and destination starts before source ends
public static void backwardCopy(int[] arr, int srcStart, int destStart, int length) {
for (int i = length - 1; i >= 0; i--) {
arr[destStart + i] = arr[srcStart + i];
}
}
// Example: Copy with overlapping ranges
@timxor
timxor / forward_copy.java
Last active November 23, 2025 08:25
Processes left-to-right and works safely only when ranges don't overlap.
// Forward Copy (left-to-right)
// Suitable when source and destination ranges do NOT overlap,
// or when destination is entirely to the left of source
public static void forwardCopy(int[] arr, int srcStart, int destStart, int length) {
for (int i = 0; i < length; i++) {
arr[destStart + i] = arr[srcStart + i];
}
}
// Example: Copy elements without overlap
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//Apple Inc.//Mac OS X 10.13.6//EN
CALSCALE:GREGORIAN
X-WR-CALNAME:The Apple Store Shopping Event
METHOD:PUBLISH
BEGIN:VEVENT
CREATED:20251120T220056Z
UID:5eb8bcff-f29c-423c-aa83-90ca9345b555
DTEND;VALUE=DATE:20251202

Documentation for Frontend Team:


API Integration: Auto-Submission with Pre-populated URL Parameters

Overview

Your API returns URLs containing query parameters. These parameters must be parsed to pre-populate form elements, then automatically submit the form on page load.

package com.web.scraper;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.jsoup.Jsoup;
notes.txt

What I Wish I'd Known About Equity Before Joining A Unicorn

Disclaimer: This piece is written anonymously. The names of a few particular companies are mentioned, but as common examples only.

This is a short write-up on things that I wish I'd known and considered before joining a private company (aka startup, aka unicorn in some cases). I'm not trying to make the case that you should never join a private company, but the power imbalance between founder and employee is extreme, and that potential candidates would

@timxor
timxor / index.html
Created September 20, 2020 07:25
iOS Like iMessage Responsive HTML5
<div class="iphone">
<div class="border">
<div class="responsive-html5-chat">
</div>
</div>
</div>
<!-- DEMO -->
<a href="http://www.adobewordpress.com/iphone-mesajlar-ekrani" target="_blank" class="article" style="display:none">Read Article</a>
@timxor
timxor / aws_debian_10_setup.sh
Created April 7, 2020 08:00
linux debian 10 ec2 setup
#!/bin/bash
# date: 04/07/2020
# file: aws_debian_10_setup.sh
# author: tim siwula <[email protected]>
#
#
# build: chmod +x aws_debian_10_setup.sh
# execute: ./aws_debian_10_setup.sh
#