Skip to content

Instantly share code, notes, and snippets.

@belaw
belaw / fork.reg
Last active Aug 7, 2021
Fork Git Client Windows Explorer Integration
View fork.reg
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\directory\background\shell\git_fork]
@="Open in &Fork"
"Icon"=hex(2):25,00,4c,00,4f,00,43,00,41,00,4c,00,41,00,50,00,50,00,44,00,41,\
00,54,00,41,00,25,00,5c,00,46,00,6f,00,72,00,6b,00,5c,00,46,00,6f,00,72,00,\
6b,00,2e,00,65,00,78,00,65,00,2c,00,30,00,00,00
[HKEY_CLASSES_ROOT\directory\background\shell\git_fork\command]
@=hex(2):22,00,25,00,4c,00,4f,00,43,00,41,00,4c,00,41,00,50,00,50,00,44,00,41,\
@changhuixu
changhuixu / CronJobService.cs
Last active Sep 3, 2021
schedule cron job. IHostedService, asp.net core
View CronJobService.cs
public abstract class CronJobService : IHostedService, IDisposable
{
private System.Timers.Timer _timer;
private readonly CronExpression _expression;
private readonly TimeZoneInfo _timeZoneInfo;
protected CronJobService(string cronExpression, TimeZoneInfo timeZoneInfo)
{
_expression = CronExpression.Parse(cronExpression);
_timeZoneInfo = timeZoneInfo;
@alexeyzimarev
alexeyzimarev / JsonNetRestSharp.cs
Created Dec 30, 2018
Using Newtonsoft.Json with RestSharp v106.6
View JsonNetRestSharp.cs
using Newtonsoft.Json;
using RestSharp;
using RestSharp.Serialization;
namespace JsonNetRestSharp
{
class Program
{
static void Main(string[] args)
{
@anvk
anvk / psql_useful_stat_queries.sql
Last active Sep 22, 2021
List of some useful Stat Queries for PSQL
View psql_useful_stat_queries.sql
--- PSQL queries which also duplicated from https://github.com/anvk/AwesomePSQLList/blob/master/README.md
--- some of them taken from https://www.slideshare.net/alexeylesovsky/deep-dive-into-postgresql-statistics-54594192
-- I'm not an expert in PSQL. Just a developer who is trying to accumulate useful stat queries which could potentially explain problems in your Postgres DB.
------------
-- Basics --
------------
-- Get indexes of tables
@anuraj
anuraj / winservice.iss
Created Jan 28, 2017
Innosetup script file for dotnet core windows service installation
View winservice.iss
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define MyAppName "dotnet core windows service"
#define MyAppVersion "1.5"
#define MyAppPublisher "dotnetthoughts"
#define MyAppURL "http://dotnetthoughts.net/"
[Setup]
; NOTE: The value of AppId uniquely identifies this application.
@fernandohu
fernandohu / Reading configuration files before application startup in Angular2 final release.md
Last active Jul 24, 2021
Reading configuration files before application startup in Angular2 final release
View Reading configuration files before application startup in Angular2 final release.md

Reading data before application startup in Angular 2

In this demonstration I will show you how to read data in Angular2 final release before application startup. You can use it to read configuration files like you do in other languages like Java, Python, Ruby, Php.

This is how the demonstration will load data:

a) It will read an env file named 'env.json'. This file indicates what is the current working environment. Options are: 'production' and 'development';

b) It will read a config JSON file based on what is found in env file. If env is "production", the file is 'config.production.json'. If env is "development", the file is 'config.development.json'.

@maxim
maxim / gh-dl-release
Last active Sep 21, 2021
Download assets from private Github releases
View gh-dl-release
#!/usr/bin/env bash
#
# gh-dl-release! It works!
#
# This script downloads an asset from latest or specific Github release of a
# private repo. Feel free to extract more of the variables into command line
# parameters.
#
# PREREQUISITES
#
@kseo
kseo / Option.cs
Created Jan 19, 2015
Step by step implementation of Option type in C#
View Option.cs
using System;
namespace Option
{
public abstract class Option<T>
{
public abstract T Value { get; }
public abstract bool IsSome { get; }
@henriquemoody
henriquemoody / http-status-codes.php
Last active Sep 8, 2021
List of HTTP status codes in PHP
View http-status-codes.php
<?php
/**
* Content from http://en.wikipedia.org/wiki/List_of_HTTP_status_codes
*
* You may also want a list of unofficial codes:
*
* 103 => 'Checkpoint',
* 218 => 'This is fine', // Apache Web Server
* 419 => 'Page Expired', // Laravel Framework