Skip to content

Instantly share code, notes, and snippets.

View RavinduSachintha's full-sized avatar
🎯
Focusing

Sachintha RavinduSachintha

🎯
Focusing
View GitHub Profile
@RavinduSachintha
RavinduSachintha / simple_sorter.sh
Created March 27, 2022 04:13
This shell script will create folders for files inside the current folder and move those files to their respective folders. Shell scripts are excluded. I usually use this for sorting movies and other videos in my machine.
#!/bin/bash
process() {
folderName="$(basename "$1" | sed 's/\(.*\)\..*/\1/' | sed 's/ /_/g')"
mkdir -p $folderName
mv "$(basename "$1")" $folderName
}
export -f process
var program = require('commander');
var browserify = require('browserify');
var express = require('express');
var path = require('path');
var rimraf = require('rimraf');
var gulp = require('gulp');
var gutil = require('gulp-util');
var gulpif = require('gulp-if');
var buffer = require('gulp-buffer');
@RavinduSachintha
RavinduSachintha / README.md
Created November 11, 2020 04:42
Kaldi with docker-compose for Linux (an easy setup)

You need to install docker and docker-compose as the first step.

Then build the container using below command. This must be run on a folder named "docker" that contains docker-compose.yml and start.sh files. (Building process will required ~1GB downloading)

docker-compose build

After the building is success, you just need to run ./start.sh file. It will handle starting. stopping actions for the container.

@RavinduSachintha
RavinduSachintha / Sublime3_SFTP_License.md
Last active January 14, 2020 09:51
A working license for Sublime 3 SFTP package

LICENSE-SUBLIME-TEXT-SFTP

This is license for sftp package of Sublime Text 3

  1. Go to Preferences/Package Settings/SFTP/Settings - User
  2. Enter json with cdket:

{ "email": "xiaosong@xiaosong.me", "product_key": "d419f6-de89e9-0aae59-2acea1-07f92a" }

Full credits goes to 2pay/LICENSE-SUBLIME-TEXT-SFTP

@RavinduSachintha
RavinduSachintha / Dockerfile
Last active January 7, 2020 05:23
Resources for the medium post of "A trick to develop huge resource consuming applications with a less powerful PC"
# base image
FROM node:12.2.0
RUN apt-get update
WORKDIR /app
ENV PATH /app/node_modules/.bin:$PATH
COPY package.json /app/package.json
RUN npm install
RUN npm install -g @angular/cli@8.3.9 --unsafe
COPY . /app
CMD ng serve --host 0.0.0.0 --proxy-config proxy.conf.json
# Tested on Ubuntu 18.04
# Update by package manager
sudo apt-get update
# Upgrade by package manager
sudo apt-get upgrade
# Install blender 2.8
sudo snap install blender --classic
@RavinduSachintha
RavinduSachintha / gpa.py
Created July 24, 2019 14:34
Calucate the GPA according to the given grade values. Both files should be in the same folder. In results file, use the same structure to add more records. (structure :- <SUBJECT_CODE> <GRADE> <CREDIT> )
f = open("results.txt","r");
globalGPA = 0
localGPA = 0
localCreditValues = 0
localCreditNumber = 0
totalCreditNumber = 0
numberOfSems = 0
def convertGradeToValue(grade):
  • ls -> list down all files and folders inside the mentioned folder
    • ls -l -> show more details about content
    • ls -a -> show hidden files too
  • cd -> go to the mentioned folder
  • tree -> show the internal files and folders using tree structure ( may be need to install the corresponding package )
    • tree -L 2 -> show tree structure upto 2 levels
  • wc -> count the characters, words, lines for a given string content
    • wc -c -> print bytes count
    • wc -m -> print character count
  • wc -l -> print new line count
@RavinduSachintha
RavinduSachintha / oracle_jdk_install_to_arch.md
Created April 21, 2019 09:15
Description about how to install Oracle JDK8 on Arch Linux OS.

Date : 21 / 04 / 2019

I thought to write this gist due to the difficulties which I had to face when installing Oracle Java Development Kit to my Arch Linux OS. At this moment, AUR links not working for installations because of direct downloads are no longer available. You have to create an Oracle account, download, and put in with the PKGBUILD.

This solution will work with Arch Linux and Manjaro.

Now let's do it.

  1. Its probably easiest to just do it manually instead of trying to dance with an automated helper and its directories.
@RavinduSachintha
RavinduSachintha / Prepare.bat
Last active February 27, 2022 22:47
Files bulk moving to own folders script using batch programming for Windows and bash scripting for Linux
@echo off
rem For each file in your folder
for %%a in (".\*") do (
rem Check if the file has an extension and if it is not our script
if "%%~xa" NEQ "" if "%%~xna" NEQ "FileSorter.bat" (
rem Check if folder exists, if not it is created
if not exist "%%~xa" mkdir "%%~xa"