Skip to content

Instantly share code, notes, and snippets.

View alea12's full-sized avatar
🏠

Kimiyasu Morikawa alea12

🏠
View GitHub Profile
@alea12
alea12 / schema.json
Created March 6, 2026 03:30
schema.json
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "EmailCategorization",
"type": "object",
"properties": {
"body": {
"type": "string",
"description": "The full body message of the email."
},
"category": {
IF({Number of Rolls} = 1,
{Barcode} & "01",
IF({Number of Rolls} = 2,
{Barcode} & "01, " & {Barcode} & "02",
IF({Number of Rolls} = 3,
{Barcode} & "01, " & {Barcode} & "02, " & {Barcode} & "03",
IF({Number of Rolls} = 4,
{Barcode} & "01, " & {Barcode} & "02, " & {Barcode} & "03, " & {Barcode} & "04",
IF({Number of Rolls} = 5,
{Barcode} & "01, " & {Barcode} & "02, " & {Barcode} & "03, " & {Barcode} & "04, " & {Barcode} & "05",
^XA
^FX ---------------------------------------
^FX QR Code on the left
^FO15,5
^BQ,2,3
^FDHA,25938
^FS
^FX ---------------------------------------
^FXText First Row, Date
@alea12
alea12 / exif_folder_renamer.py
Created October 10, 2024 14:55
exif_folder_renamer.py
import os
from PIL import Image
from PIL.ExifTags import TAGS
# Function to check if the image was taken by a Fujifilm camera
def is_fujifilm(image_path):
try:
image = Image.open(image_path)
exif_data = image._getexif()
if exif_data:
import React, {useEffect} from 'react';
import {Alert, Button, View} from 'react-native';
import {finishTransaction, Purchase, PurchaseError, useIAP, useIAPContext} from 'react-native-iap';
const PaymentComponent: React.FC = () => {
const {connected, subscriptions, currentPurchase, currentPurchaseError, requesSubscription, getSubscriptions} =
useIAP();
const {setCurrentPurchaseError} = useIAPContext();
// (1) get subscription plans
@alea12
alea12 / config.fish
Created August 6, 2021 12:41
Shortcut for creating GIF from video files (using FFmpeg)
# ~/.config/fish/config.fish
function ffmpeg-gif
ffmpeg -i $argv -filter_complex "[0:v] fps=10,scale=1080:-1,split [a][b];[a] palettegen [p];[b][p] paletteuse" $argv.gif
end
#!/bin/zsh
function command_exists {
command -v "$1" > /dev/null;
}
# Set up Xcode
if command_exists xcode-select; then
xcode-select --install
sudo xcodebuild -license accept
# generates seeds.rb from tabelog area definitions
#
# Usage:
# $ ruby tabelog.rb >> db/seeds.rb
#
# Premises:
# $ rails g model Prefecture name
# $ rails g model Area prefecture:references name
require 'nokogiri'
class SocialProfile < ApplicationRecord
belongs_to :user
store :other
validates_uniqueness_of :uid, scope: :provider
def set_values(omniauth)
return if provider.to_s != omniauth['provider'].to_s || uid != omniauth['uid']
credentials = omniauth['credentials']
info = omniauth['info']
class SocialProfile < ApplicationRecord
belongs_to :user
store :other
validates_uniqueness_of :uid, scope: :provider
def set_values(omniauth)
return if provider.to_s != omniauth['provider'].to_s || uid != omniauth['uid']
credentials = omniauth['credentials']
info = omniauth['info']