<?xml version="1.0" encoding="UTF-8" ?>
<feed xml:lang="ja" xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:thr="http://purl.org/syndication/thread/1.0">
  <title type="text">Sheeprograming</title>
  <subtitle type="html">ひつじのひよこがプログラミングします。
お仕事や趣味で困ったこととか、何度も「あれ？どうだったかしら」と調べたりしたこととか、作ったものとか、こどものこととかを書きます
★前は定期更新してましたが今は不定期更新です</subtitle>
  <link rel="self" type="application/atom+xml" href="http://sheeprogramming.iku4.com/atom"/>
  <link rel="alternate" type="text/html" href="http://sheeprogramming.iku4.com/"/>
  <updated>2015-08-08T23:35:23+09:00</updated>
  <author><name>ひよこ</name></author>
  <generator uri="//www.ninja.co.jp/blog/" version="0.9">忍者ブログ</generator>
  <atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" />
  <entry>
    <id>sheeprogramming.iku4.com://entry/672</id>
    <link rel="alternate" type="text/html" href="http://sheeprogramming.iku4.com/Entry/672/" />
    <published>2024-04-20T13:24:28+09:00</published> 
    <updated>2024-04-20T13:24:28+09:00</updated> 
    <category term="ユーティリティ" label="ユーティリティ" />
    <title>Discord のテキストチャットのログをスラッシュコマンドだけで DL する</title>
    <content mode="escaped" type="text/html" xml:lang="utf-8"> 
      <![CDATA[<blockquote class="twitter-tweet">
<p lang="ja" dir="ltr">（雛&acute;-`）.｡ｏＯ（今のところ MAX 2000 ポストまでだけど Discord のテキストチャンネルのログを Discord 上の操作だけで DL できるようにした） <a href="https://t.co/vd82Fw9Pqm">pic.twitter.com/vd82Fw9Pqm</a></p>
&mdash; しゅんしゅんひよこ (@Shunshun94) <a href="https://twitter.com/Shunshun94/status/1781531636276052137?ref_src=twsrc%5Etfw">April 20, 2024</a></blockquote>
<script async="" src="https://platform.twitter.com/widgets.js" charset="utf-8" type="text/javascript"></script>
<p><a href="https://github.com/Shunshun94/discord-textChatLogger/tree/master/python" title="" target="_blank">こちらにソースコードと説明</a>。各々設置したければ設置してください式。CGI サーバがあれば動くのでゆとシートとか運用している人なら簡単に使えるんじゃないかな</p>]]> 
    </content>
    <author>
            <name>ひよこ</name>
        </author>
  </entry>
  <entry>
    <id>sheeprogramming.iku4.com://entry/671</id>
    <link rel="alternate" type="text/html" href="http://sheeprogramming.iku4.com/Entry/671/" />
    <published>2023-03-01T23:24:42+09:00</published> 
    <updated>2023-03-01T23:24:42+09:00</updated> 
    <category term="ユーティリティ" label="ユーティリティ" />
    <title>Discord はサーバに入ってない人も BAN できる</title>
    <content mode="escaped" type="text/html" xml:lang="utf-8"> 
      <![CDATA[<p>他のサーバで見た「アッ、この人がうちのサーバに来たら困るなぁ」はままある。そんなときに未然に BAN しておく、なんてテクニックが使える。</p>
<hr />
<p>コマンドプロンプトで次のようにすると対象ユーザがサーバにいようがいまいが BAN できてしまう。無論、コマンドプロンプトでなくても BAN はできるが他のツールをわざわざ導入しなくてもできるのは旨味だろう。わかる人向けに書くと curl で Discord の API を叩いているだけなので コマンドプロンプトでなくてもやれる。</p>
<pre>curl -X PUT -H "Authorization:Bot <span style="color: red;">${BOTの Token}</span>" -d "{}" https://discordapp.com/api/guilds/<span style="color: red;">${サーバの ID}</span>/bans/<span style="color: red;">${BAN したいユーザの ID}</span>

echo 以下は実行例
curl -X PUT -H "Authorization:Bot <span style="color: red;">MzAyNDU1MTg4MzQ4NzNzNzk0.WPPhWV.M4cqMTmBNIjJpg-7s1Gd9QtyRbQ</span>" -d "{}" https://discordapp.com/api/guilds/<span style="color: red;">302452071993442307</span>/bans/<span style="color: red;">258118613125300224765463</span>
</pre>
<p>bot に適切な権限があることを実行前に確認すること。</p>
<hr />
<p>そんなことをせずとも GUI から BAN すればいいじゃないかというコメントもあると思う。だが、GUI からは今サーバにいるメンバーしか BAN できない。だが、この方法ならば対象ユーザが入ってくる前に予防的に BAN することができる。「アッ、この人がうちのサーバに来たら困るなぁ」に対して威力を発揮するわけだ。</p>]]> 
    </content>
    <author>
            <name>ひよこ</name>
        </author>
  </entry>
  <entry>
    <id>sheeprogramming.iku4.com://entry/670</id>
    <link rel="alternate" type="text/html" href="http://sheeprogramming.iku4.com/Entry/670/" />
    <published>2023-02-22T01:16:21+09:00</published> 
    <updated>2023-02-22T01:16:21+09:00</updated> 
    <category term="JavaScript" label="JavaScript" />
    <title>ゆとシートの画像圧縮</title>
    <content mode="escaped" type="text/html" xml:lang="utf-8"> 
      <![CDATA[<p>アップロード可能なサイズ（初期設定は 1MB）を超えた場合、以下で画像を圧縮している。<br />
<a href="https://github.com/yutorize/ytsheet2/blob/444d0685463fa735b9264b7f31c1d7816aefdcfd/_core/lib/edit.js#L173-L204" title="" target="_blank">_core/lib/edit.js function imageCompressor</a></p>
<hr />
<p>再帰的に圧縮を試み、<strong>10回試みて失敗したら諦めている</strong>。</p>
<hr />
<p>圧縮してアップロードするため「<a href="https://github.com/yutorize/ytsheet2/blob/444d0685463fa735b9264b7f31c1d7816aefdcfd/sw2.5/config.cgi.default#L19-L21" title="" target="_blank">config.cgi で $image_maxsize</a> の値を0にしても画像をアップロードできちゃうのかな」と思ったがそんなことはなかった。ここの値を0にすれば問題なくアップロードを禁止できる。</p>]]> 
    </content>
    <author>
            <name>ひよこ</name>
        </author>
  </entry>
  <entry>
    <id>sheeprogramming.iku4.com://entry/669</id>
    <link rel="alternate" type="text/html" href="http://sheeprogramming.iku4.com/Entry/669/" />
    <published>2023-01-09T17:32:31+09:00</published> 
    <updated>2023-01-09T17:32:31+09:00</updated> 
    <category term="仕事の雑多な話" label="仕事の雑多な話" />
    <title>Qiita でやることにした</title>
    <content mode="escaped" type="text/html" xml:lang="utf-8"> 
      <![CDATA[<p>結構長いこと毎週末更新をやっていたが、仕事上 Qiita に投げたほうが何かと得なので一般的な記事は Qiit に投げつつ、趣味によりがちな記事をここに投げる方向に切り替えるとした。もふもふ&hellip;&hellip;</p>]]> 
    </content>
    <author>
            <name>ひよこ</name>
        </author>
  </entry>
  <entry>
    <id>sheeprogramming.iku4.com://entry/667</id>
    <link rel="alternate" type="text/html" href="http://sheeprogramming.iku4.com/Entry/667/" />
    <published>2022-11-20T22:52:13+09:00</published> 
    <updated>2022-11-20T22:52:13+09:00</updated> 
    <category term="仕事の雑多な話" label="仕事の雑多な話" />
    <title>あんよが上手月間</title>
    <content mode="escaped" type="text/html" xml:lang="utf-8"> 
      <![CDATA[<p>会社がウォーキング月間なので最近散歩するようにしている。</p>
<p>普段いかないような遠くのお店にあるきでいくと楽しい&hellip;&hellip;だが、これは自分が運転免許がないからこその楽しみかもしれない。ないしは車や電車だとアクセスしにくい場所に歩いていくのもいいかもしれない。</p>
<hr />
<p>しかし、こういうキャンペーンを会社が張るとういことは運動不足傾向がまずいことになっているのだろうな。</p>]]> 
    </content>
    <author>
            <name>ひよこ</name>
        </author>
  </entry>
  <entry>
    <id>sheeprogramming.iku4.com://entry/666</id>
    <link rel="alternate" type="text/html" href="http://sheeprogramming.iku4.com/Entry/666/" />
    <published>2022-11-19T22:43:51+09:00</published> 
    <updated>2022-11-19T22:43:51+09:00</updated> 
    <category term="JavaScript" label="JavaScript" />
    <title>GAS で環境変数を使う</title>
    <content mode="escaped" type="text/html" xml:lang="utf-8"> 
      <![CDATA[<pre>const url = PropertiesService.getScriptProperties().getProperty('EXTERNAL_URL') || 'https://sheeprogramming.iku4.com/';
</pre>
<p>こうすると環境変数に値が入っていればそれを使うし、入ってなければデフォルト値を使う、というのができる。テスト環境限定の挙動とかしたい場合に使えるかも。</p>]]> 
    </content>
    <author>
            <name>ひよこ</name>
        </author>
  </entry>
  <entry>
    <id>sheeprogramming.iku4.com://entry/668</id>
    <link rel="alternate" type="text/html" href="http://sheeprogramming.iku4.com/Entry/668/" />
    <published>2022-11-13T12:37:03+09:00</published> 
    <updated>2022-11-13T12:37:03+09:00</updated> 
    <category term="ユーティリティ" label="ユーティリティ" />
    <title>録画とか</title>
    <content mode="escaped" type="text/html" xml:lang="utf-8"> 
      <![CDATA[<p>私は仕事で PC の画面を録画する際には Google Meets を使っていることが多い。Google Meet の適当な部屋に入り、画面共有した上でミーティングの録画を行うのである。Meet に誰かと一緒に入室しておく必要もない。これで趣味でも録画が簡単だなと思ったのだが、Google Meet の録画は有料プランじゃないとできないらしい（<a href="https://support.google.com/meet/answer/9308681?hl=ja" title="" target="_blank">Google Meet ヘルプ</a>）。</p>
<p>なので、趣味においては<a href="https://chrome.google.com/webstore/detail/screen-recorder-for-googl/eclbecdgdoahkliaijlpkigldlkojjdn?hl=ja" title="" target="_blank">Google Chrome 用スクリーンレコーダー</a>を単純な画面録画では使用している。これだとアプリの音や音声は入らないのがネックだが操作解説などであれば十分ではある。</p>
<hr />
<p>Windows のゲームバーが追加のアプリインストールなども要らずに最も簡単なのだと思うが、私の手元だとどうも思い通りに動いてくれない。もう少し試行錯誤してみる必要があるのかもしれない&hellip;&hellip;？</p>]]> 
    </content>
    <author>
            <name>ひよこ</name>
        </author>
  </entry>
  <entry>
    <id>sheeprogramming.iku4.com://entry/665</id>
    <link rel="alternate" type="text/html" href="http://sheeprogramming.iku4.com/Entry/665/" />
    <published>2022-11-12T22:17:56+09:00</published> 
    <updated>2022-11-12T22:17:56+09:00</updated> 
    <category term="プライベート" label="プライベート" />
    <title>次男がひとりでねんねするようになった</title>
    <content mode="escaped" type="text/html" xml:lang="utf-8"> 
      <![CDATA[<p>年長さんの次男が11月から1人で寝るようになった。ベッドで1週間寝ているが、落ちたり夜泣いたりすることもない。</p>
<p>感慨深いような、寂しいような。大人の階段のぼっている。</p>
<hr />
<p>なお、最近は急に「10dL は 1L なんだー」とか言い出したのでちょっとビビっている。</p>]]> 
    </content>
    <author>
            <name>ひよこ</name>
        </author>
  </entry>
  <entry>
    <id>sheeprogramming.iku4.com://entry/664</id>
    <link rel="alternate" type="text/html" href="http://sheeprogramming.iku4.com/Entry/664/" />
    <published>2022-11-06T22:10:30+09:00</published> 
    <updated>2022-11-06T22:10:30+09:00</updated> 
    <category term="JavaScript" label="JavaScript" />
    <title>Google Spreadsheet の装飾を HTML 化する</title>
    <content mode="escaped" type="text/html" xml:lang="utf-8"> 
      <![CDATA[<p>GAS で書いた。</p>
<pre>function myFunction() {
  const styles = [
    {
      name: 'getFontSize',
      func: (val)=&gt;{if(val) {return `font-size:${val}px;`}}
    }, {
      name: 'getForegroundColor',
      func: (val)=&gt;{if(val) {return `color:${val};`}}
    }, {
      name: 'isBold',
      func: (val)=&gt;{if(val) {return `font-weight:bold;`}}
    }, {
      name: 'isItalic',
      func: (val)=&gt;{if(val) {return 'font-style: italic;';}}
    }, {
      name: 'isStrikethrough',
      func: (val)=&gt;{if(val) {return 'text-decoration: line-through ';} else {return 'text-decoration: ';}}
    }, {
      name: 'isUnderline',
      func: (val)=&gt;{if(val) {return 'underline;';} else {return ';';}}
    }
  ];

  const sheet = SpreadsheetApp.getActiveSheet();
  const cell = sheet.getRange(1, 1);
  const elements = cell.getRichTextValue().getRuns();
  const html = elements.map((element)=&gt;{
    const style = styles.map((style)=&gt;{
      return style.func(element.getTextStyle()[style.name]()) || '';
    }).join('');
    return `&lt;span style="${style}"&gt;${element.getText().replaceAll('\n', '&lt;br/&gt;')}&lt;/span&gt;`;
  }).join('');
  console.log(html);
}
</pre>]]> 
    </content>
    <author>
            <name>ひよこ</name>
        </author>
  </entry>
  <entry>
    <id>sheeprogramming.iku4.com://entry/663</id>
    <link rel="alternate" type="text/html" href="http://sheeprogramming.iku4.com/Entry/663/" />
    <published>2022-11-05T22:05:14+09:00</published> 
    <updated>2022-11-05T22:05:14+09:00</updated> 
    <category term="HTML/CSS" label="HTML/CSS" />
    <title>ゲーミング文字列する CSS を書いた</title>
    <content mode="escaped" type="text/html" xml:lang="utf-8"> 
      <![CDATA[<p><a href="https://shunshun94.github.io/shared/other/io/github/shunshun94/util/decoration/index.html" title="" target="_blank">こちら</a>。HTML を書くのが少し面倒なのでそこだけ JS で書かせているが、一応 CSS だけで動く。</p>]]> 
    </content>
    <author>
            <name>ひよこ</name>
        </author>
  </entry>
</feed>