Skip to content

Instantly share code, notes, and snippets.

Java Date

Examples

    String date = "2016-08-16";

    //default, ISO_LOCAL_DATE

Tmux cheat sheet

(This a copy cheat sheet)

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

@rkcb
rkcb / php.date.cheat-sheet.php
Last active September 1, 2018 20:17
PHP date cheat sheet
$date = strtodate('-2 weeks', $unix_timestamp);
@rkcb
rkcb / linux_find.md
Last active September 15, 2018 12:49
Useful examples of Linux find

Examples of Linux find

List all files in current and sub directories

Find recursively all files and directories in the current path:

find

Search specific directory or path

@rkcb
rkcb / Bash scripts
Created December 6, 2018 13:39
My Bash adventures
# Copy all regular files in the current directory (including subdirectories)
# to the given directory
for x in `find -type f` ; do `cp $x /home/escobar/Pictures`; done
@rkcb
rkcb / ImageMagick.md
Last active December 12, 2018 21:46
ImageMagick scripts

ImageMagick scripts

https://imagemagick.org

create a thumbnail of size 200x200 from an image keeping the aspect ratio

convert -define jpeg:size=200x200 source.jpg -thumbnail '100x100>' target.jpg

@rkcb
rkcb / ffmpeg.md
Last active December 18, 2018 12:07
FFMpeg command line

Ffmpeg

  • split a video to two files (the first part contains 5min and the second the rest) of the same type:

ffmpeg -i bigvideo.mp4 -t 00:05:00 -c copy bigvideo_part1.mp4 -ss 00:05:00 -c copy bigvideo_part2.mp4

@rkcb
rkcb / javacommon.md
Last active March 31, 2019 22:49
Java common

Java common

Strings

Find a substring by a regular expression:

  String pattern = "(.*)(\\d\\d\\d\\d)(.*)";
  String line = "2018-11-22 00:00:00";
 Pattern re = Pattern.compile(pattern);