Skip to content

Instantly share code, notes, and snippets.

@dimobelov
dimobelov / countries.csv
Created January 10, 2021 22:22 — forked from zspine/countries.csv
Country Code, ISO and Nationality ( Please use https://mledoze.github.io/countries/ )
CCA2 Name CCA3 Nationality
AD Andorra AND Andorran
AE United Arab Emirates ARE Emirati
AF Afghanistan AFG Afghan
AG Antigua and Barbuda ATG Antiguan, Barbudan
AI Anguilla AIA Anguillian
AL Albania ALB Albanian
AM Armenia ARM Armenian
AN Netherlands Antilles NULL Dutch
AO Angola AGO Angolan
@dimobelov
dimobelov / git-clearHistory
Created January 2, 2021 18:52 — forked from stephenhardy/git-clearHistory
Steps to clear out the history of a git/github repository
-- Remove the history from
rm -rf .git
-- recreate the repos from the current content only
git init
git add .
git commit -m "Initial commit"
-- push to the github remote repos ensuring you overwrite history
git remote add origin git@github.com:<YOUR ACCOUNT>/<YOUR REPOS>.git
@dimobelov
dimobelov / font-stacks.css
Created April 27, 2020 06:24 — forked from don1138/font-stacks.css
CSS Modern Font Stacks
/* Modern Font Stacks */
/* System */
font-family: system, -apple-system, ".SFNSText-Regular", "San Francisco", "Roboto", "Segoe UI", "Helvetica Neue", "Lucida Grande", sans-serif;
/* Times New Roman-based serif */
font-family: Cambria, "Hoefler Text", Utopia, "Liberation Serif", "Nimbus Roman No9 L Regular", Times, "Times New Roman", serif;
/* A modern Georgia-based serif */
font-family: Constantia, "Lucida Bright", Lucidabright, "Lucida Serif", Lucida, "DejaVu Serif", "Bitstream Vera Serif", "Liberation Serif", Georgia, serif;
@dimobelov
dimobelov / Fisher-Yates-C#.cs
Created April 13, 2020 13:16 — forked from JerryBian/Fisher-Yates-C#.cs
Fisher-Yates-C#
public static class Program
{
private static readonly string[] Arrays = new[]
{
"jerry",
"Kate",
"Steve",
"Mark",
"Joe"
};
@dimobelov
dimobelov / ProcessAsyncHelper.cs
Created April 9, 2020 09:29 — forked from georg-jung/ProcessAsyncHelper.cs
The right way to run external process in .NET (async version)
using System;
using System.Diagnostics;
using System.Text;
using System.Threading.Tasks;
// based on https://gist.github.com/AlexMAS/276eed492bc989e13dcce7c78b9e179d
public static class ProcessAsyncHelper
{
public static async Task<ProcessResult> RunProcessAsync(string command, string arguments, int timeout)
{
@dimobelov
dimobelov / nginx-webp-sample.conf
Last active May 20, 2019 08:17 — forked from uhop/nginx-webp-sample.conf
Serving WEBP with nginx conditionally.
location ~* ^/images/.+\.(png|jpg)$ {
root /home/www-data;
add_header Vary Accept;
try_files "${uri}.webp" $uri =404;
@dimobelov
dimobelov / clean.sh
Created April 18, 2019 21:30 — forked from Iman/clean.sh
Free up disk space on Ubuntu - clean log, cache, archive packages/apt archives, orphaned packages, old kernel and remove the trash
#!/bin/sh
#Check the Drive Space Used by Cached Files
du -sh /var/cache/apt/archives
#Clean all the log file
#for logs in `find /var/log -type f`; do > $logs; done
logs=`find /var/log -type f`
for i in $logs
@dimobelov
dimobelov / Google Service Account
Created April 15, 2019 00:12 — forked from LindaLawton/Google Service Account
Example of using Google Service accounts p12, Json and key. For the Google .net client library
using Google.Apis.AnalyticsReporting.v4;
using Google.Apis.Auth.OAuth2;
using Google.Apis.Services;
using System;
using System.IO;
using System.Security.Cryptography.X509Certificates;
namespace GoogleAnaltyics.V4
{
public class ServiceAccountJson
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):e.quicklink=n()}(this,function(){var e={};function n(e){return new Promise(function(n,t){var r=new XMLHttpRequest;r.open("GET",e,r.withCredentials=!0),r.onload=function(){200===r.status?n():t()},r.send()})}var t,r,i=(t="prefetch",((r=document.createElement("link")).relList||{}).supports&&r.relList.supports(t)?function(e){return new Promise(function(n,t){var r=document.createElement("link");r.rel="prefetch",r.href=e,r.onload=n,r.onerror=t,document.head.appendChild(r)})}:n);function o(t,r,o){if(!(e[t]||(o=navigator.connection)&&((o.effectiveType||"").includes("2g")||o.saveData)))return(r?function(e){return null==self.fetch?n(e):fetch(e,{credentials:"include"})}:i)(t).then(function(){e[t]=!0})}var u=u||function(e){var n=Date.now();return setTimeout(function(){e({didTimeout:!1,timeRemaining:function(){return Math.max(0,50-(Date.now()-n))}})},1)},c=new Set,f=new IntersectionObserve
@dimobelov
dimobelov / gitlab-upload.txt
Last active February 1, 2019 07:20
GitLab API - Upload File
I created a function to also import issue attachements. I still need to add it to this lib. For anyone looking to do the work by yourself:
See: https://docs.gitlab.com/ee/api/projects.html#upload-a-file
private async Task<string> GitLabFileUploadAsync(string url, string token, string projectId, byte[] file, string fileName)
{
using (var httpClient = new HttpClient())
{
var form = new MultipartFormDataContent
{