Skip to content

Instantly share code, notes, and snippets.

View euyuil's full-sized avatar
🎯
Focusing

Liu Yue euyuil

🎯
Focusing
View GitHub Profile
@euyuil
euyuil / setup.sh
Last active March 13, 2020 16:30
Setup script for GitLab Runner and other tools with China mirrors
#!/bin/bash
# OS: Ubuntu 18.04
sudo apt-get update
sudo apt-get upgrade -y
# Reference: https://mirror.tuna.tsinghua.edu.cn/help/gitlab-runner/
curl https://packages.gitlab.com/gpg.key 2> /dev/null | sudo apt-key add - &>/dev/null
sudo echo 'deb https://mirrors.tuna.tsinghua.edu.cn/gitlab-runner/ubuntu bionic main' > /etc/apt/sources.list.d/gitlab-runner.list
@JesseObrien
JesseObrien / Dockerfile
Last active December 14, 2023 17:40
Dockerfile for asp dotnet core with timezone change, npm install, and two-stage build process. This uses the 'aspnetcore-build' container to produce the build with ALL of the SDK dependencies, and the 'aspnetcore' container to run the code itself, cutting down the production container's size.
FROM microsoft/aspnetcore-build:2.0 AS build-env
WORKDIR /app
# Copy csproj and restore as distinct layers
COPY *.csproj ./
RUN dotnet restore
# Copy everything else and build
COPY . ./
RUN rm -rf node_modules && npm install
@dcasati
dcasati / export-kubeconfig-from-aks
Created February 6, 2018 15:30
Export KUBECONFIG from AKS
az aks get-credentials --resource-group k8s-demo-ss --name k8s-demo-cluster-ss --file kubeconfig-ss
@euyuil
euyuil / fixowner.bat
Last active November 23, 2022 13:53
Windows Command Line: Fix directory ownership
takeown /F NNNNNN /A /R /D Y /SKIPSL
icacls NNNNNN /reset /T /C /L
@vanillajonathan
vanillajonathan / DescriptionTagHelper.cs
Created November 16, 2017 14:18
ASP.NET Core MVC TagHelper for description using the Display attribute
using System;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
using Microsoft.AspNetCore.Razor.TagHelpers;
namespace WebApplication.TagHelpers
{
/// <summary>
/// <see cref="ITagHelper"/> implementation targeting &lt;span&gt; elements with an <c>asp-description-for</c> attribute.
/// </summary>
[HtmlTargetElement("span", Attributes = AttributeName)]
@dentechy
dentechy / WSL-ssh-server.md
Last active July 14, 2024 03:54
A step by step tutorial on how to automatically start ssh server on boot on the Windows Subsystem for Linux

How to automatically start ssh server on boot on Windows Subsystem for Linux

Microsoft partnered with Canonical to create Bash on Ubuntu on Windows, running through a technology called the Windows Subsystem for Linux. Below are instructions on how to set up the ssh server to run automatically at boot.

  1. Edit the /etc/ssh/sshd_config file by running the command sudo vi /etc/ssh/sshd_config and do the following
    1. Change Port to 2222 (or any other port above 1000)
    2. Change PasswordAuthentication to yes. This can be changed back to no if ssh keys are setup.
  2. Restart the ssh server:
    • sudo service ssh --full-restart
  3. With this setup, the ssh server must be turned on every time you run Bash on Ubuntu on Windows, as by default it is off. Use this command to turn it on:
@therightstuff
therightstuff / RSAKeys.cs
Last active May 24, 2024 14:20
Import and export RSA Keys between C# and PEM format using BouncyCastle
using Org.BouncyCastle.Crypto;
using Org.BouncyCastle.Crypto.Parameters;
using Org.BouncyCastle.OpenSsl;
using Org.BouncyCastle.Security;
using System;
using System.IO;
using System.Security.Cryptography;
namespace MyProject.Data.Encryption
{
@fntlnz
fntlnz / self-signed-certificate-with-custom-ca.md
Last active July 23, 2024 12:13
Self Signed Certificate with Custom Root CA

Create Root CA (Done once)

Create Root Key

Attention: this is the key used to sign the certificate requests, anyone holding this can sign certificates on your behalf. So keep it in a safe place!

openssl genrsa -des3 -out rootCA.key 4096
@nemotoo
nemotoo / .gitattributes
Last active July 20, 2024 19:28
.gitattributes for Unity3D with git-lfs
## Unity ##
*.cs diff=csharp text
*.cginc text
*.shader text
*.mat merge=unityyamlmerge eol=lf
*.anim merge=unityyamlmerge eol=lf
*.unity merge=unityyamlmerge eol=lf
*.prefab merge=unityyamlmerge eol=lf
@vmrob
vmrob / nonblocking.cpp
Created February 14, 2016 07:56
simple nonblocking read from std::cin
#include <iostream>
#include <chrono>
#include <future>
#include <string>
std::string GetLineFromCin() {
std::string line;
std::getline(std::cin, line);
return line;
}