Skip to content

Instantly share code, notes, and snippets.

@zyouyowa
zyouyowa / deck2csv.py
Created January 29, 2023 06:41
デッキのurlからカード名と枚数を取得してcsv形式で出力するやつ
#!python3
from bs4 import BeautifulSoup
import requests
import sys
# Usage:
# $ python3 deck2csv.py <url>
def main():
url = sys.argv[1]
res = requests.get(url)
#define PAGE_OFFSET_MASK (~(~0UL << PAGE_SHIFT))
unsigned long page_table_walk(unsigned long addr, struct mm_struct *mm_str)
{
pgd_t *pgd;
p4d_t *p4d;
pud_t *pud;
pmd_t *pmd;
pte_t *pte;
unsigned long pfn, phys_page_addr, page_offset, phys_addr;
#pragma kernel CSMain
Texture2D<float4> srcTex;
RWTexture2D<float4> dstTex;
[numthreads(32, 32, 1)]
void CSMain(uint3 id : SV_DispatchThreadID) {
float4 up = srcTex[id.xy + int2(0, 1)];
float4 down = srcTex[id.xy + int2(0, -1)];
float4 left = srcTex[id.xy + int2(-1, 0)];
using UnityEngine;
using UnityEngine.UI;
public class ImageProcesser : MonoBehaviour {
public ComputeShader shader;
public RawImage srcImg;
public RawImage dstImg;
void Start () {
@zyouyowa
zyouyowa / ShowData.compute
Created August 22, 2018 16:13
RenderTextureにdataをプロットするだけ
#pragma kernel ShowData
StructuredBuffer<float> data;
RWTexture2D<float4> Result;
[numthreads(1024,1,1)]
void ShowData (uint id : SV_DispatchThreadID)
{
for (int i = 0; i < 256; i++) {
uint2 idx = uint2(id, i);
@zyouyowa
zyouyowa / WaitWhileExperiment.cs
Created September 22, 2017 06:18
UnityのWaitWhileでループを作れるっぽい
void Start () {
StartCoroutine (WaitWhileExperiment ());
}
IEnumerator WaitWhileExperiment(){
int a = 0;
yield return new WaitWhile (() => {
a++;
Debug.Log(a);
return a < 10;
@zyouyowa
zyouyowa / 12_5.cpp
Last active July 7, 2017 05:46
例のアレ
#include <iostream>
using namespace std;
int main(int argc, char const *argv[]){
int a[] = {10, 13, 13, 15, 20, 25};
int b[] = {6, 6, 8, 8, 11, 13};
int n = 6, w = 21;
int i = n-1, j = 0;
int i2 = i, j2 = j;
#!/bin/sh
# Example:
# ./sjis2utf8.sh sample8th/*.asm
for i in $@; do
echo $i
iconv -f SJIS -t UTF8 $i > tmp.sh
cp tmp.sh $i
rm tmp.sh
@zyouyowa
zyouyowa / postMessage.py
Created February 27, 2017 13:36
Slack APIのchat.postMessageでBotに任意の発言をさせる
import requests
url = 'https://slack.com/api/'
token = 'Slack Bot API Token'
def postMessage(msg, channel):
arguments = {
'token': token,
'channel': channel,
@zyouyowa
zyouyowa / upload.py
Created February 27, 2017 13:33
Slack APIのfiles.uploadで画像を投稿するやつ
# -*- coding: utf-8 -*-
import requests
url = 'https://slack.com/api/'
token = 'Slack Bot API Token'
def upload(filename, image, channels, filetype='jpg'):
joind_channels = ','.join(channels)
arguments = {
'token': token,