Skip to content

Instantly share code, notes, and snippets.

@GtTmy
GtTmy / my_nc_server.py
Last active November 3, 2023 14:40
ncで話すための対向
import asyncio
import aioconsole
from typing import cast
async def print_received_data(reader: asyncio.StreamReader):
while True:
# data = await reader.read()
# try:
# data = await reader.readuntil(b'\n')
@GtTmy
GtTmy / slice.rs
Created August 27, 2022 14:52
sliceで配列の一部を関数に渡す
fn add(a: &mut [i32])
{
for i in a.iter_mut() {
*i = *i + 1;
}
}
fn main()
{
let mut a = [0; 5];
@GtTmy
GtTmy / launch.json
Created February 8, 2022 13:38
cargo-embed と連携してデバッグするためのlaunch.json
{
"version": "0.2.0",
"configurations": [
{
"type": "probe-rs-debug",
"request": "attach",
"name": "probe_rs Executable launch example",
"cwd": "${workspaceFolder}",
"programBinary": "${workspaceFolder}/microbit/target/thumbv7em-none-eabihf/debug/i2c", //!MODIFY
"chip": "nrf52833_xxAA", //!MODIFY
@GtTmy
GtTmy / log.log
Created December 23, 2021 13:54
Poetry 1.1.12
$ poetry update -vvv
Using virtualenv: poetry-test-pj-gskIKeFa-py3.9
Updating dependencies
Resolving dependencies...
1: fact: poetry-test-pj is 0.1.0
1: derived: poetry-test-pj
0: Duplicate dependencies for pytest
0: Different requirements found for pytest (^4.6.11) with markers python_version >= "2.7" and python_version < "3.0" and pytest (^6.2.0) with markers python_version >= "3.7" and python_version < "4.0".
1: Version solving took 0.002 seconds.
1: Tried 1 solutions.
@GtTmy
GtTmy / json.cs
Created June 27, 2018 17:07
Json.Netでのデシリアライズの確認
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
namespace JsonDemo
{
class Program
{
public static void Main(string[] arg)
{
@GtTmy
GtTmy / tail.md
Created February 1, 2016 06:09
最新のファイルをtailする
@GtTmy
GtTmy / .latexmkrc
Created December 31, 2015 09:21
latexmk設定ファイル
if ($^O eq 'MSWin32') {
$latex = 'platex %O -kanji=utf8 -guess-input-enc -synctex=1 -interaction=nonstopmode %S';
$bibtex = 'pbibtex %O -kanji=utf8 %B';
$makeindex = 'mendex %O -U -o %D %S';
$dvipdf = 'dvipdfmx -f noembed.map %O -o %D %S';
$dvips = 'dvips %O -z -f %S | convbkmk -g > %D';
$ps2pdf = 'ps2pdf.bat %O %S %D';
$pdf_mode = 3;
if (-f 'C:/Program Files/SumatraPDF/SumatraPDF.exe') {
$pdf_previewer = '"C:/Program Files/SumatraPDF/SumatraPDF.exe" -reuse-instance';
@GtTmy
GtTmy / myLaTeXbuild.sublime-build
Last active December 31, 2015 09:40
latexmkをsublime text3で使う設定
{
"cmd": ["latexmk", "-pv", "$file_name"],
"selector": "source.tex",
}
@GtTmy
GtTmy / centos7-pub.md
Created November 30, 2015 14:10
CentOS7で公開鍵認証

CentOS7で公開鍵認証

よくミスする箇所

# chmod 700 ~/.ssh
# chmod 600 ~/.ssh/authorized_keys

ホームディレクトリ含め,すべての階層の権限が適切に設定されている必要がある.

@GtTmy
GtTmy / howToInstallPython.md
Created November 27, 2015 06:50
Pythonのソースからのインストール手順

Pythonのソースからのインストール手順

ubuntu 15.04、Python3.5でテスト

# sudo apt-get install build-essential

全モジュールをコンパイルするために、依存ライブラリを入れる。

# sudo apt-get install -y libbz2-dev libreadline-dev libssl-dev libsqlite3-dev libgdbm-dev zlib1g-dev tk-dev tcl-dev liblzma-dev libncurses5-dev