Skip to content

Instantly share code, notes, and snippets.

@cssho
cssho / Program.cs
Last active August 29, 2015 14:21
C#で「ソフトウェアエンジニアならば1時間以内に解けなければいけない5つの問題」の5問目 ref: http://qiita.com/shoooo/items/adda4a4eca72f7314c1c
using System;
using System.Linq;
namespace FiveProblemOfFive
{
class Program
{
static void Main(string[] args)
{
Enumerable.Repeat(new[] { " ", "-", "+" }, 9).Aggregate(Enumerable.Repeat("", 1)
@cssho
cssho / Program.cs
Last active August 29, 2015 14:25
「進捗・どう・です・か」をランダムに表示し「進捗どうですか」が完成したら煽ってくるプログラム(C#/LINQ) ref: http://qiita.com/shoooo/items/ec84418c37f08ecf7576
using System;
using System.Linq;
namespace ShinchokuDoudesuka
{
class Program
{
static void Main()
{
string[] words = { "進捗", "どう", "です", "か" };
@cssho
cssho / file0.txt
Created July 22, 2015 04:55
「進捗・どう・です・か」をランダムに表示し「進捗どうですか」が完成したら煽ってくるプログラム(PowerShell) ref: http://qiita.com/shoooo/items/5494192779ebb6a8fd1b
do{"進捗","どう","です","か"|Get-Random|%{$res+=$_}}while(!$res.EndsWith("進捗どうですか"))Write-Host $res "???`r`n" $res.Length"文字で煽られました。"
@cssho
cssho / Program.cs
Last active September 6, 2015 12:18
POH6+ 「え、妻が松江?」松江Ruby会議07協賛 回文作成プログラミングコンテストをC#で解いてみた ref: http://qiita.com/shoooo/items/9eb29b8f63154815d3cf
using System;
using System.Linq;
namespace Kaibun
{
class Kaibun
{
static void Main(string[] args)
{
var list = Enumerable.Repeat(0, int.Parse(Console.ReadLine())).Select(x => Console.ReadLine()).ToArray();
@cssho
cssho / Check-MyNumber.ps1
Created October 31, 2015 08:54
WindowsPowerShell & C#マイナンバーのチェックデジットを計算する ref: http://qiita.com/shoooo/items/42bbdd9023c14661da0a
filter Get-CalcResult{
if($_ -le 6 ){
return [int]$digits[$digits.Length - 2 - $_] * ($_ + 1)
}else{
return [int]$digits[$digits.Length - 2 - $_] * ($_ - 5)
}
}
function Check-MyNumber{
param(
# -*- coding: utf-8 -*-
from docx import Document
def appears_in_paragraph(paragraph, match_string):
return match_string in paragraph.text
def replace_all_occurences(paragraph, match_string, replacement_string):
before_text = paragraph.text
after_text = before_text.replace(match_string, replacement_string)
paragraph.clear()
@cssho
cssho / Program.cs
Last active February 10, 2016 22:57
Tor.NETを使ってC#からTorしてみる ref: http://qiita.com/shoooo/items/edc4585f707fb383ac93
using System;
using System.Diagnostics;
using System.IO;
using System.Net;
using System.Net.Http;
using Tor;
using Tor.Config;
using static System.Console;
namespace TorClient
@cssho
cssho / FileList2Markdown.ps1
Created February 25, 2016 07:19
PowerShellでファイルの一覧をMarkdownに出力 ref: http://qiita.com/shoooo/items/7811837e02de61e1e4ac
param(
[Parameter(Mandatory=$true)]
[string]
$TargetPath,
[string]
$OutputPath
)
function Convert-Markdown {
param(
@cssho
cssho / file0.py
Created March 22, 2016 03:52
派手にズンドコきよし with Python ref: http://qiita.com/shoooo/items/a99cc17e99c5b8e4a321
# -*- coding: utf-8 -*-
from asciimatics.effects import Cycle, Stars
from asciimatics.renderers import ColourImageFile
from asciimatics.scene import Scene
from asciimatics.screen import Screen
from collections import deque
import random
import time
z = u'ズン'
@cssho
cssho / code.gs
Created February 19, 2020 08:23
Visual Studio Marketplace API bot for Slack.
function doPost(e) {
var result = { text:':thinking_face:'};
switch(e.parameter.command){
case '/ranking': result = ranking(e.parameter.text); break;
case '/statics': result = statics(e.parameter.text); break;
}
return ContentService.createTextOutput(JSON.stringify(result)).setMimeType(ContentService.MimeType.JSON);
}