Skip to content

Instantly share code, notes, and snippets.

@tado
tado / emacs.ahk
Created March 7, 2025 09:25
Autohot Key Emacs keybind Setting
#Requires AutoHotkey v2.0
;;
;; An autohotkey script that provides emacs-like keybinding on Windows
;;
;; global constants
DEBUG_MODE := 0
;; global variables
@tado
tado / iris.py
Created February 27, 2025 23:57
Plot iris petal scatter with regression with python
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
from matplotlib.patches import Ellipse
from sklearn.linear_model import LinearRegression
from sklearn.metrics import r2_score
def plot_iris_petal_scatter_with_regression():
"""
@tado
tado / hello.py
Last active February 13, 2025 00:03
Hello p5!
from p5 import *
import random
width = 1280
height = 720
circle_count = 500
circles = []
def setup():
size(width, height)
@tado
tado / animation.py
Last active February 21, 2025 05:37
Simple animation sketch for p5 python
from p5 import *
import random
width = 1280
height = 720
circle_count = 400
circles = []
def setup():
size(width, height)
@tado
tado / markdown-pdf.css
Created December 12, 2024 08:11
Vscode: Markdown PDF style css
/*
* Markdown PDF CSS
*/
body {
/* font-family: -apple-system, BlinkMacSystemFont, "Segoe WPC", "Segoe UI", "Ubuntu", "Droid Sans", sans-serif, "Meiryo";*/
font-family: 'Roboto Mono', 'Noto Sans JP', sans-serif;
/* font-size: 14px; */
/* padding: 0 12px; */
padding: 0 12.5%;
@tado
tado / main.cpp
Last active June 25, 2024 09:43
C++ Pointer Explanation
int val = 123; // 値を代入
cout << "val: " << val << endl; // 値を表示
cout << "&val: " << &val << endl; // 値が格納されているアドレスを表示
int* ptr; // ポインタを作成
ptr = &val; // ポインタにアドレスを格納
cout << "ptr: " << ptr << endl; // 値が格納されているアドレスを表示
cout << "*ptr: " << *ptr << endl; // ポインタに格納された値を表示
int* intPtr = new int(); // Int型値を格納する領域をメモリーに新規生成
@tado
tado / sketch.js
Last active May 23, 2024 05:06
p5.js Animation
function setup() {
createCanvas(windowWidth, windowHeight);
colorMode(HSB, 360, 100, 100, 100);
locationX = width / 2;
locationY = height / 2;
velocityX = random(-50, 50);
velocityY = random(-50, 50);
}
function draw() {
@tado
tado / ofApp.cpp
Last active May 21, 2024 10:55
openFrameworks 3D vector animation
#include "ofApp.h"
void ofApp::setup() {
}
void ofApp::update() {
for (int i = 0; i < location.size(); i++) {
location[i] += velocity[i];
if (location[i].x < 0 || location[i].x > ofGetWidth()) {
velocity[i].x *= -1;
@tado
tado / ofApp.cpp
Last active May 14, 2024 11:44
openFrameworks Array Animation Template
#include "ofApp.h"
void ofApp::setup() {
}
void ofApp::update() {
for (int i = 0; i < location.size(); i++) {
location[i] += velocity[i];
if (location[i].x < 0 || location[i].x > ofGetWidth()) {
velocity[i].x *= -1;
@tado
tado / ofApp.cpp
Created May 7, 2024 06:30
openFrameworks Animation Basic Template
#include "ofApp.h"
void ofApp::setup() {
locationX = ofGetWidth() / 2.0;
locationY = ofGetHeight() / 2.0;
velocityX = ofRandom(-10, 10);
velocityY = ofRandom(-10, 10);
}
void ofApp::update() {