Skip to content

Instantly share code, notes, and snippets.

View mohsenasm's full-sized avatar
🏠
Working from home

Mohammad-Mohsen Aseman-Manzar mohsenasm

🏠
Working from home
View GitHub Profile
@mohsenasm
mohsenasm / samsung_motion_photo_extractor.py
Last active December 18, 2025 14:16
Samsung Motion Photo extractor
#!/usr/bin/env python3
"""
Samsung Motion Photo extractor
This code is the minimal version of the work in https://github.com/joemck/ExtractMotionPhotos
Usage: python3 samsung_motion_photo_extractor.py <motion_photo_file>
"""
def init_search(magic):
"""
@mohsenasm
mohsenasm / WebSocket.js
Last active April 15, 2020 06:56
React WebSocket With Hook
import { useState, useCallback, useRef } from 'react';
function useWebSocket(url) {
const [isConnected, setConnected] = useState(false);
const [socket, setSocket] = useState(null);
const isReconnectionEnable = useRef(true);
const setReconnectionEnable = useCallback((newValue) => {
isReconnectionEnable.current = newValue;
}, []);
@mohsenasm
mohsenasm / iOS Swift Bounce Animation
Last active May 20, 2019 11:41
iOS Swift Bounce Animation
extension UIView {
func bounceAnimationX(angle: Double, speed: Double = 1) {
var inTransform = CATransform3DIdentity;
inTransform.m34 = 1.0 / 1000.0;
inTransform = CATransform3DRotate(inTransform, CGFloat(angle * Double.pi / 180), 0, 1, 0)
var outTransform = CATransform3DIdentity;
outTransform.m34 = 1.0 / 500.0;
outTransform = CATransform3DRotate(outTransform, 0, 0, 1, 0)