Skip to content

Instantly share code, notes, and snippets.

View wpbonelli's full-sized avatar

wpbonelli

  • UCAR / @usgs
  • 20:11 (UTC -04:00)
View GitHub Profile
from shapely.geometry import LineString, MultiLineString, Point
from collections import deque
def split_line_string(line_string):
"""Break a LineString"""
for start, end in zip(line_string.coords[:-1], line_string.coords[1:]):
yield LineString((start, end))
@scivision
scivision / ci_cmake.yml
Last active February 22, 2023 11:27
GitHub Actions CI MSYS2 with MS-MPI on Windows
name: CI CMake
env:
CMAKE_BUILD_TYPE: Release
CMAKE_GENERATOR: Ninja
CTEST_PARALLEL_LEVEL: 2
on:
push:
- "**/CMakeLists.txt"
@33eyes
33eyes / commit_jupyter_notebooks_code_to_git_and_keep_output_locally.md
Last active July 9, 2024 10:18
How to commit jupyter notebooks without output to git while keeping the notebooks outputs intact locally

Commit jupyter notebooks code to git and keep output locally

  1. Add a filter to git config by running the following command in bash inside the repo:
git config filter.strip-notebook-output.clean 'jupyter nbconvert --ClearOutputPreprocessor.enabled=True --to=notebook --stdin --stdout --log-level=ERROR'  
  1. Create a .gitattributes file inside the directory with the notebooks

  2. Add the following to that file:

About variadics in Rust

This is an analysis of how variadic generics could be added to Rust. It's not a proposal so much as a summary of existing work, and a toolbox for creating an eventual proposal.

Introduction

Variadic generics (aka variadic templates, or variadic tuples), are an often-requested feature that would enable traits, functions and data structures to be generic over a variable number of types.

To give a quick example, a Rust function with variadic generics might look like this:

@pacarvalho
pacarvalho / slurm-enqueue-job.yml
Last active March 23, 2024 13:40
Sample Github Action Workflow To Enqueue Job With SLURM Cluster
name: SLURM Enqueue Workflow
on:
push:
branches:
- 'master'
jobs:
enqueue:
runs-on: ubuntu-latest
@wolfv
wolfv / github_actions.yaml
Last active March 10, 2024 15:28
micromamba usage
name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
from dagster import pipeline, solid, RepositoryDefinition, InputDefinition, execute_pipeline_iterator, DagsterInstance
@solid(input_defs=[InputDefinition("number", int)])
def my_solid(context, number):
context.log.info("Number: {}".format(number))
# Stop condition to prevent infinite recursion
if number == 5:
return
@berkorbay
berkorbay / github_desktop_ubuntu.md
Last active July 25, 2024 10:23
To install Github Desktop for Ubuntu

IMPORTANT

See the following links for further updates to Github Desktop for Ubuntu. These are official instructions. (also mentioned by fetwar on Nov 3, 2023)

For the sake of "maintaining the tradition" here is the updated version.

@vznncv
vznncv / paramiko_sftp_large_file_downloading_demo.py
Created January 18, 2020 09:26
Workaround to download a large file with paramiko from a sftp server
"""
The script contains example of the paramiko usage for large file downloading.
It implements :func:`download` with limited number of concurrent requests to server, whereas
paramiko implementation of the :meth:`paramiko.SFTPClient.getfo` send read requests without
limitations, that can cause problems if large file is being downloaded.
"""
import logging
import os
$ sudo apt-get update
$ sudo apt-get install unzip wget
$ wget https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip
$ unzip ngrok-stable-linux-amd64.zip
$ sudo mv ./ngrok /usr/bin/ngrok
$ ngrok