Skip to content

Instantly share code, notes, and snippets.

View nickpreston24's full-sized avatar
🏠
Working remote

Nicholas Preston nickpreston24

🏠
Working remote
View GitHub Profile
@nickpreston24
nickpreston24 / ObjectToDictionaryHelper.cs
Created April 25, 2024 01:14 — forked from jarrettmeyer/ObjectToDictionaryHelper.cs
C# convert an object to a dictionary of its properties
public static class ObjectToDictionaryHelper
{
public static IDictionary<string, object> ToDictionary(this object source)
{
return source.ToDictionary<object>();
}
public static IDictionary<string, T> ToDictionary<T>(this object source)
{
if (source == null)
@nickpreston24
nickpreston24 / curl.sh
Created March 31, 2024 14:21 — forked from FylmTM/curl.sh
Neo4j curl call example
#!/bin/bash
QUERY=query.json
time curl -i -XPOST \
-o output.log \
--data "@$QUERY" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
http://127.0.0.1:7474/db/data/transaction/commit
@nickpreston24
nickpreston24 / GetSellers.sql
Created January 19, 2023 02:33 — forked from rflechner/GetSellers.sql
How to store SQL files in assembly and execute them in C#
-- this file Embedded resource
SELECT * FROM "Sellers"
@nickpreston24
nickpreston24 / GetSellers.sql
Created January 19, 2023 02:33 — forked from rflechner/GetSellers.sql
How to store SQL files in assembly and execute them in C#
-- this file Embedded resource
SELECT * FROM "Sellers"
@nickpreston24
nickpreston24 / daemon.js
Created July 31, 2021 16:38 — forked from kumatch/daemon.js
Node.js daemon example
var fs = require('fs');
var INTERVAL = 1000;
var cycle_stop = false;
var daemon = false;
var timer;
process.argv.forEach(function (arg) {
if (arg === '-d') daemon = true;

1. Clone your fork:

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
@nickpreston24
nickpreston24 / FSGrep.cs
Created February 7, 2020 21:37 — forked from wcharczuk/FSGrep.cs
C# File System Grep
public class FSGrep
{
public FSGrep()
{
this.Recursive = true;
}
public String RootPath { get; set; }
public Boolean Recursive { get; set; }
public String FileSearchMask { get; set; }
@nickpreston24
nickpreston24 / FreeIOMonad.cs
Created January 5, 2020 04:09 — forked from dadhi/FreeIOMonad.cs
Example of Free IO monad in pure C# with separated re-usable monad implementation
/*
Modified from the original https://gist.github.com/louthy/524fbe8965d3a2aae1b576cdd8e971e4
- removed dependency on [language-ext](https://github.com/louthy/language-ext)
- separated monadic boilerplate, so you may concentrate on describing the operations and interpretation of the program
- removed `IO<A>.Faulted` to simplify the examples. It can be added back in straightforward manner.
Useful links:
- [John DeGoes: Beyond Free Monads - λC Winter Retreat 2017](https://www.youtube.com/watch?v=A-lmrvsUi2Y)
- [Free and tagless compared - how not to commit to a monad too early](https://softwaremill.com/free-tagless-compared-how-not-to-commit-to-monad-too-early)
@nickpreston24
nickpreston24 / Manjaro-tricks.md
Created January 4, 2020 05:45 — forked from boseji/Manjaro-tricks.md
Manjaro Linux : Tips and Tricks (ARCH Linux under the hood)

Manjaro Linux : Tips and Tricks

We have been using [Manjaro linux][2] for past year and have been happy with its perfomance. Though we don't use te [AUR][1] (Arch User Repository, since many are not supported into Manjaro.

The best part is even with bad / dumb users like myself, IT-DOES-NOT-BREAK. So, we very much recommend [Manjaro][2].

It seriously worked much better than Ubuntu. We might not be able to have all the boat load of software & support like Debian, but we are happy.