Skip to content

Instantly share code, notes, and snippets.

View UncleStranger's full-sized avatar

Andrey Evdokimov UncleStranger

View GitHub Profile
@UncleStranger
UncleStranger / README.md
Created October 24, 2023 14:10 — forked from cbuckowitz/README.md
Change Storage Location for Docker Desktop with WSL2 #DockerDesktop #WSL2

Change the Storage Location for Docker Desktop with WSL2

Docker Desktop stores docker data in 2 distros

  • docker-desktop
  • docker-desktop-data

These distros are installed on the system drive by default.

To move them to another drive, these distros can be exported, deleted and imported from the new location.

@UncleStranger
UncleStranger / ApplicationHost.cs
Created November 21, 2021 21:23 — forked from poke/ApplicationHost.cs
Running ASP.NET Core as Windows Service with Topshelf
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Hosting.Server.Features;
using Microsoft.AspNetCore.Server.Kestrel;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.IO;
namespace ExampleApp
{
@UncleStranger
UncleStranger / RsaKeyService.cs
Created February 4, 2021 11:10 — forked from mykeels/RsaKeyService.cs
For IdentityServer4's AddSigningCredentials in production
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Security.Cryptography;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting;
using Microsoft.IdentityModel.Tokens;
@UncleStranger
UncleStranger / dropzone.js
Created January 12, 2021 07:54 — forked from aziz-blr/dropzone.js
custom events for dropzone including server side rendering & max files upload limit
$(function () {
// Get the template HTML and remove it from the doumenthe template HTML and remove it from the doument
var previewNode = document.querySelector("#referenceTemplate");
previewNode.id = "";
var previewTemplate = previewNode.parentNode.innerHTML;
previewNode.parentNode.removeChild(previewNode);
Dropzone.autoDiscover = false;
var myDropzone = new Dropzone(".uploadReference", {// Make the whole body a dropzone
url: "ajax/upload-file.php", // Set the url
@UncleStranger
UncleStranger / client.c
Created July 23, 2019 13:30 — forked from Alexey-N-Chernyshov/client.c
Example of client/server with select().
// Simple example of client.
// Client prints received messages to stdout and sends from stdin.
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <signal.h>
#include <unistd.h>
#include <sys/select.h>
#include <netinet/in.h>
@UncleStranger
UncleStranger / _service.md
Created May 29, 2019 12:37 — forked from naholyr/_service.md
Sample /etc/init.d script

Sample service script for debianoids

Look at LSB init scripts for more information.

Usage

Copy to /etc/init.d:

# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)
#include <iostream>
#include <cstdlib>
#include <unistd.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
using namespace std;
int main(int argc, char *argv[])
@UncleStranger
UncleStranger / StructLayout.txt
Created January 22, 2019 08:09 — forked from unitycoder/StructLayout.txt
C# Struct StructLayout LayoutKind.Sequential c++
// https://forum.unity.com/threads/matching-c-structure-with-a-c-one.454072/#post-2943687
// c#
[StructLayout(LayoutKind.Sequential)]
public struct ChatChannelMessageEntry
{
public uint chatMessageIndex;
public uint chatUserID;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)]
@UncleStranger
UncleStranger / gateway_netlink.c
Created December 21, 2018 02:56 — forked from javiermon/LICENSE
get default gateway
@UncleStranger
UncleStranger / c-get_eth_mac.c
Created July 25, 2018 08:52 — forked from evanslai/c-get_eth_mac.c
C: How to get MAC address of your machine using a C program
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <linux/if.h>
#include <netdb.h>
#include <stdio.h>
#include <string.h>
int main()
{
struct ifreq s;