Skip to content

Instantly share code, notes, and snippets.

@cnruby
cnruby / add_passwor_ssh_config.md
Last active July 1, 2020 19:26
adding password to .ssh/config

using ssh-forever

# need to install ruby
# install ssh-forever on macos or linux
gem install ssh-forever
# adding password to .ssh/config
@cnruby
cnruby / ls-recursively-wildcards.md
Created June 13, 2020 09:18
Run `ls` recursively with wildcards
@cnruby
cnruby / bfg.md
Last active June 13, 2020 08:39
BFG Repo-Cleaner: Remove files and folders from git history permanently(代码库历史文件和目录删除软件)
  • Remove files and folders from git history permanently(代码库历史文件和目录删除软件)
  • Removes large or troublesome blobs like git-filter-branch does, but faster, simpler, better and easier

Step 0: Get tool: BFG Repo-Cleaner

wget https://repo1.maven.org/maven2/com/madgag/bfg/1.13.0/bfg-1.13.0.jar

Step 1: download your Repo

@cnruby
cnruby / cut_video.sh
Last active March 28, 2020 01:04
Cutting the videos based on start and end time using ffmpeg
// https://stackoverflow.com/questions/18444194/cutting-the-videos-based-on-start-and-end-time-using-ffmpeg
INPUT_VIDEO=input
CUT_OUTPUT_VIDEO=cut_output
BEGIN_TIME="00:00:03"
END_TIME="00:00:08"
ffmpeg -ss $BEGIN_TIME -t $END_TIME -i $INPUT_VIDEO.mp4 -acodec copy -vcodec copy -async 1 $CUT_OUTPUT_VIDEO.mp4
@cnruby
cnruby / fix_permissions.sh
Created March 26, 2020 18:59
how to fix Homebrew permissions?
# fix my permissions for OSX Homebrew
# https://github.com/Homebrew/legacy-homebrew/issues/43301
sudo chown -R "$USER":admin /usr/local
@cnruby
cnruby / merging-mp4.sh
Last active March 26, 2020 21:24
ffpmeg-merging-mp4-video-files
# install ffmpeg on MacOS
brew install ffmpeg
brew cask install vlc
# merge two vidoes into one video
ls
INPUT_VIDEO_1=input_01
INPUT_VIDEO_2=input_02
OUTPUT_VIDEO=output
ffmpeg -i $INPUT_VIDEO_1.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts $INPUT_VIDEO_1.ts
@cnruby
cnruby / main.dart
Created December 8, 2019 16:50
Flutter App 3D: Customize for iOS and Android
import 'package:flutter/material.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/cupertino.dart';
const String _name = "YourName";
final ThemeData kIOSTheme = new ThemeData(
primarySwatch: Colors.orange,
primaryColor: Colors.grey[100],
primaryColorBrightness: Brightness.light,
@cnruby
cnruby / main.dart
Created December 8, 2019 16:49
Flutter App 3C: wrapping longer messages, and adding native-looking customizations
import 'package:flutter/material.dart';
const String _name = "YourName";
void main() {
runApp(new FriendlychatApp());
}
class FriendlychatApp extends StatelessWidget {
@override
@cnruby
cnruby / main.dart
Created December 8, 2019 16:17
Flutter App 3B: making the Send button enabled only when there's text to send
import 'package:flutter/material.dart';
const String _name = "YourName";
void main() {
runApp(new FriendlychatApp());
}
class FriendlychatApp extends StatelessWidget {
@override
@cnruby
cnruby / main.dart
Created December 8, 2019 15:55
Flutter App 3A: Animate your app with class SizeTransition
import 'package:flutter/material.dart';
const String _name = "YourName";
void main() {
runApp(new FriendlychatApp());
}
class FriendlychatApp extends StatelessWidget {
@override