Skip to content

Instantly share code, notes, and snippets.

@erjan
erjan / json_to_csv_chunk_splitter.py
Created February 26, 2025 08:31
json to csv file splitter - mandy chan
import json
import os
import time
import csv
def dump_to_csv(data, filename):
with open(filename, 'w', newline='') as csvfile:
writer = csv.writer(csvfile, delimiter='\t')
@erjan
erjan / process_json_split_into_blocks.py
Last active February 24, 2025 11:15
generate json file guid 470mb - task from mandy
import json
import os
import time
def split_json_by_guid_station(input_file, output_dir, chunk_size_mb):
"""
Splits a JSON file into smaller files, ensuring that each file
contains complete 'guid_station' entries. It avoids splitting a
'guid_station' across multiple files.
this includes timing and progress output.
class Trie:
def __init__(self):
self.endword = False
self.children = [None]*26
def insert(self,word):
print()
curr = self
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from datetime import datetime
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from selenium.common.exceptions import TimeoutException
from selenium.webdriver.common.action_chains import ActionChains
driver = webdriver.Chrome()
@erjan
erjan / sending_java_email
Last active December 12, 2017 07:09
how to send email with java[working code]
import java.util.Properties;
import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.PasswordAuthentication;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
@erjan
erjan / string_nice_split.java
Created December 14, 2015 05:21
split a long string but not in the middle of a word
private String[] split_string(String newQuestion){
/*
this:
"According to Ruzbihan, these 2 tribe
s were part of both uzbek and mangits"
must be:
"According to Ruzbihan, these 2 tribes
were part of both uzbek and mangits"
@erjan
erjan / reversing_linked_list
Last active August 29, 2015 14:04
node testing
public class node {
int value ;
node next ;
public node(int newvalue){
value = newvalue ;
next = null ;
}