Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Param( | |
[parameter(mandatory)][String]$outputFile | |
) | |
$divider="-- $("=" * 100)" | |
$files = Get-ChildItem .\*.* -Include *.sql -Exclude $outputFile | |
if (Test-Path $outputFile) { Clear-Content $outputFile } | |
function output { | |
process { | |
Out-File -Encoding UTF8 -FilePath $outputFile -Append -InputObject $PSItem |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Usage: ./register_sso_user.sh toyonaka@example.com toyonaka taro all | |
# arg1: Email (例: toyonaka@example.com) | |
# arg2: 氏 (例: toyonaka) | |
# arg3: 名 (例: taro) | |
# arg4: グループ名 (例: all) | |
set -xe | |
if (( $# != 4 )); then | |
echo "Usage: $0 <email> <family_name> <given_name> <group_name>" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Buffer } from "buffer"; | |
import zlib from "zlib"; | |
export function gzip(str: string) { | |
return zlib.gzipSync(encodeURIComponent(str)).toString("base64"); | |
} | |
export function unzip(value: string) { | |
return decodeURIComponent(zlib.unzipSync(Buffer.from(value, "base64")).toString()); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function ConvertToPascalCase([Parameter(ValueFromPipeline)] [string] $text) { | |
($text -split '-' | ForEach-Object { | |
"$($_.ToCharArray()[0].ToString().ToUpper())$($_.Substring(1))" }) -join '' | |
} | |
function ConvertToKebabCase([Parameter(ValueFromPipeline)] [string] $text) { | |
([regex]"^-*").Replace(([regex]"[A-Z]").Replace($text, { "-" + $args[0].Groups[0].Value.ToLower() }), "") | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Param( | |
[parameter(mandatory)][String]$outputFile | |
) | |
$divider="-- $("=" * 100)" | |
$files = Get-ChildItem .\*.* -Include *.sql -Exclude $outputFile | |
if (Test-Path $outputFile) { Clear-Content $outputFile } | |
function output { | |
process { | |
Out-File -Encoding UTF8 -FilePath $outputFile -Append -InputObject $PSItem |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
CACHE_FILE=~/.aws/aws-mfa-cache | |
OTHER="other" | |
function input_account () { | |
read -p "Account ID? " AWS_ACCOUNT_ID | |
read -p "Username? " AWS_USERNAME | |
read -p "Profile? " AWS_PROFILE | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const GITHUB_API_URL = 'https://api.github.com'; | |
const GITHUB_TOKEN = '<GitHub API Token>'; | |
// Prepare axios for GitHub API | |
const axiosBase = require('axios'); | |
const github = axiosBase.create({ | |
baseURL: GITHUB_API_URL, | |
headers: { | |
'Content-Type': 'application/json', | |
'Authorization': `token ${GITHUB_TOKEN}`, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections.Generic; | |
using System.IO; | |
using System.Text; | |
/// <summary> | |
/// Provides iterators to read lines in a file. | |
/// </summary> | |
public static class TextFile | |
{ | |
/// <summary> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// .NET 5 まで | |
using System.Linq; | |
using System.Security.Cryptography; | |
using System.Text; | |
public static class StringExtensions | |
{ | |
static readonly SHA256CryptoServiceProvider hashProvider = new SHA256CryptoServiceProvider(); | |
public static string GetSHA256HashedString(this string value) | |
=> string.Join("", hashProvider.ComputeHash(Encoding.UTF8.GetBytes(value)).Select(x => $"{x:x2}")); |
NewerOlder