Skip to content

Instantly share code, notes, and snippets.

View soachishti's full-sized avatar
💭
Away

Owais soachishti

💭
Away
View GitHub Profile
@soachishti
soachishti / getScaleAndPrecision.js
Created October 7, 2019 11:38
Get Scale and Precision from Number - JavaScript
// Database Number: Scale and Precision
// Input: 123456.1234
// Output: scale 4, precision 6
function getScaleAndPrecision(x) {
x = parseFloat(x);
if (!x || isNaN(x)) return null; //NaN, undefined, null, 'abcd', ""...
let parts = x.toString().split(".");
if (parts.length > 2) return null;
return {
scale: parts[1] ? parts[1].length : 0,
@soachishti
soachishti / noscript-tracking.go
Created May 13, 2019 07:07 — forked from wybiral/noscript-tracking.go
Tracking cursor position in real-time with remote monitoring (without JavaScript)
// Tracking cursor position in real-time without JavaScript
// Demo: https://twitter.com/davywtf/status/1124146339259002881
package main
import (
"fmt"
"net/http"
"strings"
)
@soachishti
soachishti / rsa.py
Created March 28, 2018 19:35
A simple RSA implementation in Python
'''
620031587
Net-Centric Computing Assignment
Part A - RSA Encryption
'''
import random
'''
@soachishti
soachishti / adobecs6.pol
Created March 21, 2018 21:52
Adobe Photostop CS6 PlayOnLinux Script
#!/bin/bash
# Date : (2014-10-20)
# Distribution used to test : Arch Linux 64-bit
# Author : RoninDusette
# Licence : GPLv3
# PlayOnLinux: 4.2.8
[ "$PLAYONLINUX" = "" ] && exit 0
source "$PLAYONLINUX/lib/sources"
@soachishti
soachishti / Fraction.cpp
Created January 31, 2018 17:08
Implement Fraction class with operator overloading.
/*
Name: Syed Owais Ali Chishti
Roll no: P14-6011
Task: Implement Fraction class such that it take input like
1/2, 4/5, 7/81
Then overload
ARITHMETIC
+, -, /, %, *
ASSIGNMENT
+=, -=, *=, /=, %=
@soachishti
soachishti / PlayFair.cpp
Created January 31, 2018 17:06
Implementation of Playfair Cipher Algorithm
/*
* Name: Syed Owais Ali Chishti
* Roll no: P14-6011
* Date: 2/3/2015
* Task: Implement the Playfair Cipher Algorithm as discussed in the class.
*/
#include <iostream>
#include <string>
#include <cstdlib>
@soachishti
soachishti / PermissionReset.php
Created March 28, 2017 16:53
Reset permission of all files and directory to 0755 - WordPress
<?php
$rii = new RecursiveIteratorIterator(new RecursiveDirectoryIterator('/public_html/'));
$files = array();
foreach ($rii as $file) {
if (!$file->isDir()) {
chmod($file->getPathname(), 0755);
}
else {
@soachishti
soachishti / pc2-compiler-path.txt
Created November 13, 2016 14:15
Visual Studio Compiler Path for PC2
"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" && cl.exe "{:mainfile}"
g++ -lm -o {:basename}.exe {:mainfile}
@soachishti
soachishti / slatenu-dl.py
Created October 2, 2016 14:20
Script to download all course resources from http://slate.nu.edu.pk
import requests
from lxml import html
import sys, os, errno
import Queue
from threading import Thread
import getpass
user = raw_input("Username: ");
passwd = getpass.getpass();
@soachishti
soachishti / StartOracle.bat
Created May 10, 2016 17:07
Start and Stop Oracle Service
@echo off
set /P mode=Start or Stop Oracle:
IF %mode%==start (
echo "Starting Oracle Server"
net start OracleOraDB12Home2MTSRecoveryService
net start OracleOraDB12Home2TNSListener
net start OracleVssWriterORCLDB
net start OracleServiceORCLDB
) ELSE IF %mode%==stop (
echo "Stoping Oracle Server"