Skip to content

Instantly share code, notes, and snippets.

@msymt
msymt / REAMDE.md
Created July 23, 2022 07:07
C# to C IPC with memory mapped file

MappedMemory: C# to C

  1. From console create file: dd if=/dev/zero of=/tmp/sharedfile bs=12288 count=1
  2. The C# program
  3. The C program

usage

mcs Sender.cs
@msymt
msymt / Main.cs
Last active July 4, 2022 08:06
How to call libc library in C#
using System;
using System.Runtime.InteropServices;
namespace PInvokeSamples
{
public static class Program
{
[DllImport("libc.so.6")]
private static extern int fork();
[DllImport("libc.so.6")]
@msymt
msymt / subprocess_cat.py
Last active June 27, 2022 09:05
python上であるファイルの中身をoutputにリダイレクトしたいとき
import subprocess
# $cat input > output
subprocess.run(['cat'], stdin=open("input", 'r'), stdout=open("output", 'a'))
@msymt
msymt / parent_child_pipe.c
Last active April 18, 2022 07:09
パイプによる親子プロセス間通信(parentが書き込み、childが読み込んで標準出力)
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#define BUFFSIZE 512
#define err(mess) { fprintf(stderr,"Error: %s.\n", mess); exit(1); }
@msymt
msymt / fuyuko.c
Last active March 27, 2022 12:56
シャニマス 冬優子の思い出演出中に表れたソースコード
#include<stdio.h>
int main(void) {
for(int i = 0; i < 8; i++) {
for(int x = 0; x < 20; x++) {
int d = x - 10;
if (d <= 0) {
d *= -1;
}
char c = ' ';
@msymt
msymt / jass.c
Last active October 12, 2021 07:51
janssonのexample
#include<stdio.h>
#include<stdlib.h>
#include<jansson.h>
void jansson_pack_stdout_free(json_t *root) {
char *out = json_dumps(root, JSON_ENCODE_ANY);
printf("out:%s\r\n", out);
free(root);
free(out);
@msymt
msymt / bbl_calc.py
Last active May 31, 2024 04:49
Ghidraでバイナリの基本ブロックを計算するスクリプト
# ref: https://reverseengineering.stackexchange.com/questions/23469/way-to-get-basic-blocks-of-a-binary-using-ghidra
from ghidra.program.model.block import BasicBlockModel
from ghidra.util.task import TaskMonitor
bbm = BasicBlockModel(currentProgram)
blocks = bbm.getCodeBlocks(TaskMonitor.DUMMY)
block = blocks.next()
bbl_cnt = 0
while block:
@msymt
msymt / .commit_template
Created September 10, 2021 15:19 — forked from Jung0/.commit_template
🤘 Emoji prefix to use at commit message
# ==================== Emojis ====================
# 🎉 :tada: 初めてのコミット(Initial Commit)
# 🔖 :bookmark: バージョンタグ(Version Tag)
# ✨ :sparkles: 新機能(New Feature)
# 🐛 :bug: バグ修正(Bagfix)
# ♻️ :recycle: リファクタリング(Refactoring)
# 📚 :books: ドキュメント(Documentation)
# 🎨 :art: デザインUI/UX(Accessibility)
@msymt
msymt / google-translate.md
Last active August 30, 2021 09:11
「Google翻訳とPythonを使ってPDF論文を一発で翻訳する」使用時のメモ
@msymt
msymt / angr-setup.md
Last active August 27, 2021 03:35
angrのセットアップ

env

  • macOS Big Sur v11.4
  • Python 3.8.2
  • Poetry 1.1.7

setup