Skip to content

Instantly share code, notes, and snippets.

@Hardu2203
Hardu2203 / clone_sub.sh
Last active April 10, 2022 23:10 — forked from Sanix-Darker/clone_sub.sh
[BASH]clone_sub.sh
#!/bin/bash
# First parameter is the sub-directory-absolute-path
# Second parameter is the link of the repo
# A smart split to get the repo-name, with / as a separator
REPO_NAME="$(echo $2 | grep -oE '[^/]+$')"
git init $REPO_NAME
cd $REPO_NAME
@tdcosta100
tdcosta100 / WSL2GUIXvnc-en.md
Last active April 27, 2024 08:11
A tutorial to use GUI in WSL2 replacing original XServer by Xvnc, allowing WSL to work like native Linux, including login screen

WSL2 with GUI using Xvnc

In this tutorial, we will setup GUI in WSL2, and access it using VNC. No additional software outside WSL (like VcXsrv) is required, except, of course, a VNC Viewer (RealVNC, TightVNC, TigerVNC, UVNC, etc, all of them might work flawlessly).

The key component we need to install is tigervnc-standalone-server.

For this setup, I will use Ubuntu 20.04 LTS (Focal Fossa, unfortunately 22.04 does not work), and install GNOME Desktop. Since the key components aren't bound to Ubuntu or GNOME, you can use your favorite distro and GUI. Check the Sample screenshots section for examples.

So let's go. First, we need a working WSL2 installation.

@joewiz
joewiz / export-eXide-tabs.xq
Last active September 18, 2020 20:10
Save eXide editor tabs to disk
xquery version "3.1";
(:
# Save eXide editor tabs to disk
1. Install "LocalStorage Manager" Chrome extension
https://chrome.google.com/webstore/detail/localstorage-manager/fkhoimdhngkiicbjobkinobjkoefhkap
@hyrmn
hyrmn / oldway.cs
Last active August 1, 2023 09:07
Polly.Contrib.WaitAndRetry examples
var transientErrors = new HashSet<WebExceptionStatus>(new[]
{
WebExceptionStatus.ConnectFailure,
WebExceptionStatus.ConnectionClosed,
WebExceptionStatus.KeepAliveFailure,
WebExceptionStatus.Pending,
WebExceptionStatus.PipelineFailure,
WebExceptionStatus.ProtocolError,
WebExceptionStatus.ReceiveFailure,
WebExceptionStatus.RequestCanceled,
@dwighthouse
dwighthouse / ThisLikeRef.js
Created September 11, 2019 20:31
Using This-Like Ref Structure to Solve Hook State Updating and Function Reference Problems
import React, { memo, useCallback } from 'react';
import ChildComponent from './wherever/ChildComponent.js';
const updateChild = (props, childId, changes) => {
props.onUpdate({
type: 'childChanged',
childId: childId,
changes: changes,
});
};
@apal21
apal21 / ES5 class.js
Last active March 7, 2023 08:06
Example for blog to show the difference between ES5 and ES6 javascript classes using inheritance and prototypes use cases.
'use strict';
/**
* Person class.
*
* @constructor
* @param {String} name - name of a person.
* @param {Number} age - age of a person.
* @param {String} gender - gender of a person.
*/
@iknowcodesoup
iknowcodesoup / FeatureClassNameTests.cs
Last active August 6, 2020 18:09
This is a non-tested sample of how to use TheoryData to create a unit testing setup using stubs / mocks. Have been using it for years with much success. Not sure of the original article but this one is the first hit: https://andrewlock.net/creating-strongly-typed-xunit-theory-test-data-with-theorydata/
using System;
using Moq;
using Refit;
using Xunit;
namespace Some.Kind.Of.Space
{
[Collection("Feature Name")]
[Trait("Feature Aspect", "Classification")]
public class FeatureClassNameTests
@hsupu
hsupu / httpclient-demo.ps1
Last active March 23, 2021 00:17
PowerShell HttpClient ServerCertificateCustomValidationCallback demo
$cscode = @"
using System;
using System.Net.Http;
using System.Net.Security;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
using System.Text;
public class My {
@carlolars
carlolars / .wsl-git.md
Last active February 4, 2024 07:21
HOWTO: Use WSL and its Git in a mixed development environment

How to setup a development environment where Git from WSL integrates with native Windows applications, using the Windows home folder as the WSL home and using Git from WSL for all tools.

Note if using Git for Windows, or any tool on the Windows side that does not use Git from WSL then there will likely be problems with file permissions if using those files from inside WSL.

Tools

These are the tools I use:

  • git (wsl) - Command line git from within WSL.
  • Fork (windows) - Git GUI (must be used with wslgit)
  • wslgit - Makes git from WSL available for Windows applications. Important! Follow the installation instructions and do (at least) the first optional step and then the Usage in Fork instructions.
msys2 vs msys vs msysgit
MinGW doesn't provide a linux-like environment, that is MSYS(2) and/or Cygwin
Cygwin is an attempt to create a complete UNIX/POSIX environment on Windows.
MinGW is a C/C++ compiler suite which allows you to create Windows executables - you only
need the normal MSVC runtimes, which are part of any normal Microsoft Windows installation.
MinGW provides headers and libraries so that GCC (a compiler suite,
not just a "unix/linux compiler") can be built and used against the Windows C runtime.