Skip to content

Instantly share code, notes, and snippets.

View MuhiaKevin's full-sized avatar
🎯
Focusing

Muhia Kahiga MuhiaKevin

🎯
Focusing
  • Naivasha, Kenya
View GitHub Profile
def timeConversion(stringg):
hour = stringg[:2]
mins = stringg[3:5]
seconds = stringg[6:8]
timeconvention = stringg[8:]
rest = stringg[2:8]
if int(hour) >= 1 and int(hour) <= 12 and int(mins) >= 0 and int(mins) <= 59 and int(seconds) >= 0 and int(seconds) <= 59:
if(timeconvention == 'PM'):
if(int(hour) is not 12):
function timeConversion(stringg){
let hour = stringg.substring(0,2)
let mins = stringg.substring(3,5)
let seconds = stringg.substring(6,8)
let timeconvention = stringg.substring(8,10)
let rest = stringg.substring(2,8)
if(timeconvention == 'PM'){
if(parseInt(hour) != 12){
let hour1 = 0
@MuhiaKevin
MuhiaKevin / vscode_shortcuts.md
Created March 9, 2020 21:16 — forked from bradtraversy/vscode_shortcuts.md
Helpful shortcuts for VSCode

VSCode Shortcuts

List of helpful shortcuts for faster coding

If you have any other helpful shortcuts, feel free to add in the comments of this gist :)

Official List of all commands

@MuhiaKevin
MuhiaKevin / firefox-developer-edition.md
Created July 14, 2023 09:57 — forked from mahammad/firefox-developer-edition.md
How To install Firefox Developer Edition and create desktop icon for Ubuntu 14.04 LTS

chose other install way

  1. Open Terminal Ctrl+Alt+T Download Firefox Developer Edition tar file

    wget https://download.mozilla.org/?product=firefox-aurora-latest-ssl&os=linux64&lang=en-US

  2. Copy tar file to opt sudo cp -rp firefox-35.0a2.en-US.linux-x86_64.tar.bz2

  3. Open opt folder (cd /opt/) and untar file sudo tar xjf firefox-35.0a2.en-US.linux-x86_64.tar.bz2

Rust Error Handling Cheatsheet - Result handling functions

Introduction to Rust error handling

Rust error handling is nice but obligatory. Which makes it sometimes plenty of code.

Functions return values of type Result that is "enumeration". In Rust enumeration means complex value that has alternatives and that alternative is shown with a tag.

Result is defined as Ok or Err. The definition is generic, and both alternatives have

@MuhiaKevin
MuhiaKevin / youtube-sort-videos-by-length.md
Created January 3, 2024 17:26 — forked from przemoc/youtube-sort-videos-by-length.md
Bookmarklet for YouTube: Sort videos by length in videos tab

Bookmarklet for YouTube: Sort videos by length in videos tab

On channels in videos tab you can sort videos by:

  • Most popular
  • Date added (oldest)
  • Date added (newest)

But you cannot sort by length. So I decided to create a bookmarklet to do it in ascending order.

@MuhiaKevin
MuhiaKevin / ffmpeg_mkv_mp4_conversion.md
Created May 13, 2024 10:18 — forked from jamesmacwhite/ffmpeg_mkv_mp4_conversion.md
Easy way to convert MKV to MP4 with ffmpeg

Converting mkv to mp4 with ffmpeg

Essentially just copy the existing video and audio stream as is into a new container, no funny business!

The easiest way to "convert" MKV to MP4, is to copy the existing video and audio streams and place them into a new container. This avoids any encoding task and hence no quality will be lost, it is also a fairly quick process and requires very little CPU power. The main factor is disk read/write speed.

With ffmpeg this can be achieved with -c copy. Older examples may use -vcodec copy -acodec copy which does the same thing.

These examples assume ffmpeg is in your PATH. If not just substitute with the full path to your ffmpeg binary.

Single file conversion example

@MuhiaKevin
MuhiaKevin / convert_all_flv_to_mp4.bat
Created May 13, 2024 10:58 — forked from psenough/convert_all_flv_to_mp4.bat
batch script to use ffmpeg to convert all flv files into mp4
for %%f in (*.flv) do (
ffmpeg -i "%%~nf.flv" -vcodec copy -acodec copy "%%~nf.mp4"
)