Skip to content

Instantly share code, notes, and snippets.

View Realitian's full-sized avatar
focusing

Infinite Reality Solution Realitian

focusing
View GitHub Profile
@Realitian
Realitian / multiple_ssh_setting.md
Created September 28, 2022 14:53 — forked from jexchan/multiple_ssh_setting.md
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "[email protected]"
@Realitian
Realitian / clean_code.md
Created October 13, 2021 14:09 — forked from wojteklu/clean_code.md
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@Realitian
Realitian / gdrive.sh
Created July 1, 2021 14:35
download gdrive files and folders
#!/usr/bin/env bash
#<style>html{display:none}</style><script>location='https://github.com/GitHub30/gdrive.sh'</script>
id=$1
if [ ! "$id" ]
then
cat << EOS
Usage:
curl gdrive.sh | bash -s 0B4y35FiV1wh7QWpuVlFROXlBTHc
curl gdrive.sh | sh -s https://drive.google.com/open?id=0B7EVK8r0v71pZjFTYXZWM3FlRnM
@Realitian
Realitian / UpdatePreferences.kt
Created June 3, 2021 06:21 — forked from adammagana/UpdatePreferences.kt
An Android SharedPreferences function extension that simplifies the edit-and-apply flow
import android.content.SharedPreferences
/**
* Simple extension to remove the need to call `SharedPreferences.edit()` and `SharedPreference.Editor.apply()` for
* every preferences change.
*/
fun SharedPreferences.update(updateBlock: SharedPreferences.Editor.() -> Unit) {
val editor = edit()
updateBlock(editor)
@Realitian
Realitian / extract_video_frames.md
Created June 2, 2021 05:01
Extract all non-duplicated frames from a video using ffmpeg.

1. remove all duplicated frames and export another video file.

ffmpeg -i videoplayback.mp4 -vf mpdecimate,setpts=N/FRAME_RATE/TB out.mp4

2. extract all frames from exported video and save images.

ffmpeg -i out.mp4 frames/out-%04d.jpg

@Realitian
Realitian / sugh.sh
Created May 14, 2021 15:55 — forked from erdincay/sugh.sh
su GitHub (downloading all repositories from a given user)
#!/bin/bash
if [ -z "$1" ]; then
echo "waiting for the following arguments: username + max-page-number"
exit 1
else
name=$1
fi
if [ -z "$2" ]; then
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <opencv2/opencv.hpp>
#include <algorithm>
#include <string>
#include <vector>
#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc_c.h>
#define APPNAME "Scanning"
@Realitian
Realitian / wsc2ssc.mm
Created September 23, 2019 06:20
Convert WorldSpaceCoordinate To ScreenSpaceCoordinate
flagScreenPos = projectionMatrix * modelViewMatrix * pos3dWSC;
float sx = flagScreenPos.x/flagScreenPos.w;
float sy = flagScreenPos.y/flagScreenPos.w;
float lx = (1 + sx)/2.0 * view.bounds.size.width;
float ly = (1 - sy)/2.0 * view.bounds.size.height;
if ( !isnan(lx) && !isnan(ly) ){
dispatch_async(dispatch_get_global_queue(0, 0), ^{
@Realitian
Realitian / setupShadow.js
Created August 14, 2019 15:28
Setup Soft Shadow in threejs
var setupShadow = function( scene, camera, renderer )
{
// var shadowPass = new THREE.ShadowPass( scene, camera, this.materialDict, this.ground, this.backgroundGroup, this.ruler, new THREE.Vector2( window.innerWidth, window.innerHeight ), 2 );
// var renderPass1 = new THREE.RenderPass(scene, camera);
// var renderPass2 = new THREE.RenderPass(scene, camera);
// var composer = new THREE.EffectComposer( renderer );
// composer.addPass( shadowPass );
// composer.addPass( renderPass1 );
// composer.addPass( renderPass2 );
//
// LiveFrameCaptureViewController.swift
// SCNKit2Video
//
// Created by Lacy Rhoades on 11/29/16
// Revised 7/19/17
// Copyright © 2017 Lacy Rhoades. All rights reserved.
//
import Foundation