Skip to content

Instantly share code, notes, and snippets.

View alea12's full-sized avatar
🏠

alea12 alea12

🏠
View GitHub Profile
@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']
require 'json'
require 'open-uri'
require 'slack-notifier'
url = ENV["ETHERMINE_API_URL"]
json = JSON.load(open url)
message = "Unpaid Balance: #{json['unpaid'] / 10.0 ** 18} ETH \n"
json['workers'].each do |worker, status|
message << "#{worker}: #{status['hashrate']} \n"
require 'json'
require 'open-uri'
require 'slack-notifier'
url = ENV["ETHERMINE_API_URL"]
json = JSON.load(open url)
message = "Unpaid Balance: #{json['unpaid'] / 10.0 ** 18} ETH \n"
json['workers'].each do |worker, status|
message << "#{worker}: #{status['hashrate']} \n"
@alea12
alea12 / crontab
Created March 28, 2017 02:50
Nginx + Let's Encrypt + Rails5 + Puma
00 05 01 * * /home/alea12/letsencrypt/letsencrypt-auto certonly --webroot -w /var/www/html -d example.net --renew-by-default && nginx -t && nginx -s reload