Skip to content

Instantly share code, notes, and snippets.

Ikiru Yoshizaki guitarrapc

Block or report user

Report or block guitarrapc

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@guitarrapc
guitarrapc / fail.cmd
Created May 16, 2019
cmd FINDSTR can act as RegularExpression
View fail.cmd
echo hogemoge-dev | FINDSTR /R ".*staging\>" > NUL
IF %errorlevel% EQU 0 (
echo success staging
) ELSE (
echo fail staging
)
@guitarrapc
guitarrapc / DrawTextToPng.cs
Created May 15, 2019
Draw text to png file generated by SkiaSharp. https://github.com/mono/SkiaSharp
View DrawTextToPng.cs
void Main()
{
DrawTextToPng("Hogemoge-fugaf@-!!!$&'&piyo_-=hiogfew", 10);
}
public void DrawTextToPng(string text, int xPadding = 0)
{
// draw some text
var paint = new SKPaint
{
@guitarrapc
guitarrapc / config
Created May 10, 2019
.ssh config for fowarding
View config
# proxy
Host your-domain-*
ProxyCommand ssh -W %h:%p host.name.is.here
# foward and connect
Host your-bastion-domain-*
User your_user_name
ProxyCommand ssh -W %h:%p foward-domain-name.io
IdentityFile ~/.ssh/id_rsa
ForwardAgent yes
View UAC_RunAsSelfFunction.ps1
$currentPrincipal = New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent())
if (!$currentPrincipal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
$me = $MyInvocation.MyCommand
$myDefinition = (Get-Command $me).Definition
$myfunction = "function $me { $myDefinition }"
$cd = (Get-Location).Path
$commands = "Set-Location $cd; $myfunction; Write-Host 'Running $me'; $me; Pause"
$bytes = [System.Text.Encoding]::Unicode.GetBytes($commands)
$encode = [Convert]::ToBase64String($bytes)
View HomeController.cs
public IActionResult Index()
{
var vm = new IndexViewModel
{
Secret = _config.GetValue<string>("ConnectionStrings:DATABASE"),
};
return View(vm);
}
View Program.cs
public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.AddAwsSecrets(null, "ap-northeast-1", "PROFILE_NAME")
.UseStartup<Startup>();
View Program.cs
public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.AddAwsSecrets("ap-northeast-1")
.UseStartup<Startup>();
View AwsSecretsConfigurationBuilderExtensions.cs
using Amazon;
using Amazon.Runtime;
using Amazon.SecretsManager.Model;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using System;
using System.Collections.Generic;
using System.Linq;
namespace AwsSecretStoreAspNetCore
View AwsSecretsManagerSettings.cs
private class AwsSecretsManagerSettings
{
/// <summary>
/// The allowed secret groups, e.g. Shared or MyAppsSecrets
/// </summary>
public string[] SecretGroups { get; set; } = Array.Empty<string>();
}
View HomeController.cs
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using AwsSecretStoreAspNetCore.Models;
using Microsoft.Extensions.Configuration;
using AwsSecretStoreAspNetCore.Models.Home;
You can’t perform that action at this time.