Skip to content

Instantly share code, notes, and snippets.

View sualeh's full-sized avatar
⚠️
404 Not Found

Sualeh Fatehi sualeh

⚠️
404 Not Found
View GitHub Profile
@sualeh
sualeh / test_lab1_for_grading.py
Last active September 19, 2022 18:01
COMP-880 Lab 1 Grading Tests
"""Tests for lab1 module."""
import pytest
import lab1
def test_minimum_0():
"""Tests an argument of None, and ensures that no error occurs."""
data = None
assert lab1.minimum(data) is None
@sualeh
sualeh / JavaRounding.java
Last active April 7, 2022 22:01
Java Rounding Demo
// See https://www.online-java.com/6uKwX2DOQ9
public class JavaRounding
{
public static void main(String []args)
{
System.out.println(0.9 - 0.1);
System.out.println(0.7 + 0.1);
}
}
@sualeh
sualeh / eclipse-java-google-style.xml
Created September 10, 2021 23:38
eclipse-java-google-style.xml - with minor tweaks
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<profiles version="21">
<profile kind="CodeFormatterProfile" name="GoogleStyle" version="21">
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_ellipsis" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_for_statment" value="common_lines"/>
<setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter" value="do not insert"/>
@sualeh
sualeh / how-to-quickly-create-a-test-database.md
Created September 9, 2021 02:25
How to Quickly Create a Test Database

How to Quickly Create a Test Database

Chinook is an open source test database (schema and data) that was created as an alternative to Microsoft's Northwind database. For a while now, Luis Rocha has provided scripts to create this database with his lerocha/chinook-database project. These scripts support building Chinook for Microsoft SQL Server, Oracle, MySQL, PostgreSQL and IBM DB2. However, this project has not been updated in a few years, and the scripts are in different formats and encodings.

schemacrawler/chinook-database builds on the earlier project. The project has an automatic build using GitHub Actions, which pulls scripts from lerocha/chinook-database, cleans them up, and converts them all to UTF-8 with consistent line-endings. Then are are repacked and redistributed in various ways - as a Java jar file for use in Java p

@sualeh
sualeh / Issue503.java
Last active August 19, 2021 23:39
SchemaCrawler issue #503
package schemacrawler.test;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
import java.util.regex.Pattern;
import org.junit.jupiter.api.Test;
import schemacrawler.inclusionrule.RegularExpressionRule;
public class Issue503 {
@sualeh
sualeh / FlatOptionsTest.java
Created January 31, 2021 01:24
Getting injected parse results
package schemacrawler.test.commandline.command;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;
import org.junit.jupiter.api.Test;
import picocli.CommandLine;
import picocli.CommandLine.Command;
import picocli.CommandLine.Model.CommandSpec;
@sualeh
sualeh / resume.json
Last active June 18, 2022 20:41
Sualeh Fatehi - JSON Resume
{
"meta": {
"theme": "short"
},
"basics": {
"name": "Sualeh Fatehi",
"label": "Software Engineer; Open Source Enthusiast; Team Manager",
"image": "",
"email": "sualeh@hotmail.com",
"url": "https://sualeh.github.io/",
@sualeh
sualeh / how_to_sign_and_release_to_the_central_repository_with_github_actions.md
Last active April 5, 2024 05:55
How to Sign and Release to The Central Repository with GitHub Actions

How to Sign and Release to The Central Repository with GitHub Actions

GitHub allows automated builds using GitHub Actions. A commonly asked question is how to release artifacts (packaged Java jars) built by Maven and Gradle to The Central Repository. The GitHub Actions documentation provides only part of the answer.

So, first, configure your Maven project for staging artifacts to The Central Repository, by reading through Configuring Your Project for Deployment and following those steps. Please make sure that the maven-gpg-plugin is configured to prevent gpg from using PIN entry programs, as follows:

<configuration>
  <gpgArguments>
      <arg>--pinentry-mode</arg>
 loopback
@sualeh
sualeh / Issue293.java
Last active February 22, 2021 23:26
SchemaCrawler Issue #293
import java.sql.Connection;
import schemacrawler.crawl.SchemaCrawler;
import schemacrawler.schema.Catalog;
import schemacrawler.schema.Column;
import schemacrawler.schema.Schema;
import schemacrawler.schema.Table;
import schemacrawler.schemacrawler.InfoLevel;
import schemacrawler.schemacrawler.InformationSchemaKey;
import schemacrawler.schemacrawler.RegularExpressionInclusionRule;
@sualeh
sualeh / How to Use git to Find Modified Files.md
Last active July 7, 2021 09:40
How to Use git to Find Modified Files

Introduction

I keep a number of personal files on my computer, organized in folders. These could be photos, financial information, and so on. As I work with these files, I add to them, sometimes modify them to edit a photo, or add to notes, and move or rename them in various ways to reorganize. I wanted a good way to keep track of these changes.

My first thought is that I would write a Python program to scan the folders, and print MD5 checksums of each file in a readable way. This way, I could save off the old "index", and compare it with a new index using a standard diff tool. My attempt at this program is sualeh/diff-name-only. My disclaimer if you look at the code is that I am still teaching myself Python, and have not reached the heights of Pythonic Zen.

As I was writing this code, I was struck by how much of what I needed was already done by a standard source control system such as git. I could simply use git, and solve my problems. However, git keeps tr