Skip to content

Instantly share code, notes, and snippets.

View shi-yan's full-sized avatar
💭
keyboard smashing

Shi Yan shi-yan

💭
keyboard smashing
View GitHub Profile
@shi-yan
shi-yan / mpegts
Last active February 10, 2017 00:02
ffmpeg cut video into mpegts
ffmpeg -i 360.mp4 -bsf:v h264_mp4toannexb -f segment -segment_list_type m3u8 -segment_list playl -c copy -map 0 output02%d.ts
ffmpeg -i result-%03d.png -c:v libx264 -vf fps=25 -pix_fmt yuv420p out.mp4
@shi-yan
shi-yan / subl
Created May 26, 2017 21:20
set subl command on Mac
/usr/local/bin/subl -> /Applications/Sublime Text.app/Contents/SharedSupport/bin/subl
@shi-yan
shi-yan / gist:4f9670b0aad49f3cdab635da29b8c67e
Created June 7, 2017 21:03
count line numbers in a folder recursively
find . -name '*.h' -o -name '*.cpp' | xargs wc -l
@shi-yan
shi-yan / reportip.sh
Last active May 2, 2018 16:57
My work machine changes IP, If I want to ssh into it from home, often I need to know its ip. This is the bash script to report ip change to my slack. Need to set cron job: crontab -e, 0 * * * * /home/xxx/reportip.sh
#!/bin/bash
touch oldIp.txt
md1=$(cat "oldIp.txt");
md2=$(hostname -I);
if [ "$md1" = "$md2" ]; then
echo The same
else
wc `find . -type f \( -name "*.h" -o -name "*.cpp" -o -name "*.c" -o -name "*.hpp" -o -name "*.cc" \)`
@shi-yan
shi-yan / node_odbc_ms_odbc_17.md
Last active September 18, 2018 00:02
How to solve node-odbc + Microsoft ODBC driver issue [error:140A90A1:SSL routines:SSL_CTX_new:library has no ciphers]
{ [Error: [unixODBC][Microsoft][ODBC Driver 17 for SQL Server]SSL Provider: [error:140A90A1:SSL routines:SSL_CTX_new:library has no ciphers]]
  errors:
   [ { message:
        '[unixODBC][Microsoft][ODBC Driver 17 for SQL Server]SSL Provider: [error:140A90A1:SSL routines:SSL_CTX_new:library has no ciphers]',
       state: '08001' },
     { message:
        '[unixODBC][Microsoft][ODBC Driver 17 for SQL Server]Client unable to establish connection',
       state: '08001' } ],
  error: '[node-odbc] SQL_ERROR',
@shi-yan
shi-yan / gist:3b2225bd267fcd6114de87d4a7e2c063
Created November 1, 2018 22:07
gdb exit if program succeeds, break if program crashes?
https://stackoverflow.com/questions/8657648/how-to-have-gdb-exit-if-program-succeeds-break-if-program-crashes
If you put the following lines in your ~/.gdbinit file, gdb will exit when your program exits with a status code of 0.
python
def exit_handler ( event ):
if event .exit_code == 0:
gdb .execute ( "quit" )
@shi-yan
shi-yan / gist:eaf177def8bfc81fb617090cda9d28ce
Created November 15, 2018 17:54
ssh Connection reset by xxxx port 22 error solution
run
sudo dpkg-reconfigure openssh-server
@shi-yan
shi-yan / gist:d34734cf37f4d3287220c56cc64fe86c
Created November 18, 2018 17:22
save tmux buffer into file
https://unix.stackexchange.com/questions/26548/write-all-tmux-scrollback-to-a-file
@shi-yan
shi-yan / gist:e7ec250792d8b43ed4b29a649a250abc
Created July 11, 2019 17:51
how to print all cmake variables for debugging
get_cmake_property(_variableNames VARIABLES)
list (SORT _variableNames)
foreach (_variableName ${_variableNames})
message(STATUS "${_variableName}=${${_variableName}}")
endforeach()