Skip to content

Instantly share code, notes, and snippets.

void Main()
{
string filePath = @"example.csv";
SylvanCsv(filePath);
}
List<string> SylvanCsv(string filePath)
{
StreamReader sr = new(filePath);
@niko86
niko86 / NumericChecks.cs
Last active August 18, 2021 11:27
Initial code for checking numeric precision validity against AGS Rule 8
using AgsVerifierLibrary.Enums;
using AgsVerifierLibrary.Models;
using System;
using System.Text.RegularExpressions;
namespace AgsVerifierLibrary.Actions
{
public static class NumericChecks
{
// Using static compiled regex for performance reasons.
import os
import sys
sys.path.append(os.getcwd())
import clr
clr.AddReference('wpf\PresentationFramework')
from System import String
from System.IO import StreamReader
from System.Threading import ApartmentState, Thread, ThreadStart
from System.Windows import Application, LogicalTreeHelper, Window
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
Title="Gaiaform" Height="600" Width="800">
<Grid>
<DataGrid Name="TestDataGrid" />
</Grid>
</Window>
import os
import sys
sys.path.append(os.getcwd())
import clr
clr.AddReference('wpf\PresentationFramework')
from System.IO import StreamReader
from System.Threading import ApartmentState, Thread, ThreadStart
from System.Windows import Application, LogicalTreeHelper, Window
from System.Windows.Markup import XamlReader
@niko86
niko86 / RamerDouglasPeucker.bas
Last active June 10, 2019 23:52
Working DouglasPeucker algorithm, implemented in Excel VBA. Three things are required in a spreadsheet, one a named range "Epsilon", two a "Table1" on "Sheet1" and three "Table2" on "Sheet2".
Sub MultiColumnTable_To_Array()
Dim pointList As Variant
Dim rowCount As Integer
Dim result As Variant
Dim epsilon As Double
Call ClearOutput
pointList = Sheets("Sheet1").Range("Table1")
class Project(models.Model):
project_code = models.CharField(max_length=7, unique=True)
class Hole(models.Model):
hole_number = models.CharField(max_length=16)
project = models.ForeignKey('Project', on_delete=models.CASCADE,
blank=True, null=True, related_name='holes', verbose_name='Project')
@niko86
niko86 / geol.py
Last active February 25, 2017 22:43
"""Library for obtaining data from BGS WMS servers.
Unfortunately the BGS do not provide a simple text based API to access geology information for specific coordinates
or areas within a bounding box.
Available classes:
- GeoBGS: When called instantiates a GeoBGS object.
"""
from io import BytesIO
import os
import re
pattern_guide_1 = (r'S\d{6}\Z', 'Input project number >> ')
pattern_guide_2 = (r'\A[123]{1}\Z', 'Input selection number >> ')
ds = ['DS/Envirocheck', 'DS/Photos']
si = ['SI/Photos']
jobs = {
'1': ds,
@niko86
niko86 / shp_file_extract.py
Last active April 9, 2016 14:30
Extracts all .shp files from any .zip files in the current working directory of the script.
#! python3
import os
import shutil
import zipfile
from zipfile import ZipFile
from os.path import basename
list_zip_file = [files for files in os.listdir(".") if zipfile.is_zipfile(files)]
for zip_file in list_zip_file:
zip_file = ZipFile(zip_file)