Skip to content

Instantly share code, notes, and snippets.

View rahulduttt's full-sized avatar
🏠
Working from home

Rahul Dutt rahulduttt

🏠
Working from home
View GitHub Profile
@rahulduttt
rahulduttt / svelte.md
Created February 18, 2022 20:09 — forked from peltho/svelte.md
Svelte cheatsheet
@rahulduttt
rahulduttt / BackupService.cs
Created April 18, 2020 04:49
Backup SQL Server Programmatically with C#
//https://stackoverflow.com/questions/9835553/how-to-backup-sql-database-programmatically-in-c-sharp
public class BackupService
{
private readonly string _connectionString;
private readonly string _backupFolderFullPath;
private readonly string[] _systemDatabaseNames = { "master", "tempdb", "model", "msdb" };
public BackupService(string connectionString, string backupFolderFullPath)
{
_connectionString = connectionString;
/* Takes a list ofdelimited strings, where the delimiter is intended to imply
* a hierarchy ( somewhat like a file system path ) and turns it into
* a tree-like structure consisting of nodes looking something like
* { name: "", children: [] }
* The tree starts at the root node, which is ( no foolin' ) called
* root. So the top (root) node is:
* { name: "root", children: [xxx] }
*/
function listOfDelimitedStringsToTree(lines, delimiter){
function stringTreeToObjectTree(root){
@rahulduttt
rahulduttt / get-ms-sql-server-expiry
Last active December 20, 2018 21:25
Query the License Expiry Date for MS SQL Server
SELECT
@@SERVERNAME SERVERNAME,
CREATE_DATE 'INSTALALTIONDATE',
SERVERPROPERTY('EDITION') 'Version',
DATEADD(DD, 180, CREATE_DATE) AS 'EXPIRY DATE'
FROM SYS.SERVER_PRINCIPALS
WHERE SID = 0X010100000000000512000000
PrincipalContext adContext = new PrincipalContext(ContextType.Domain,"192.168.10.5"); //AD IP
adContext.ValidateCredentials("acton",<PASSWORD>); //returns bool
@rahulduttt
rahulduttt / GetAudioFileLength
Created May 31, 2018 22:08
Code Snippet to get Audio File Frames
File file = new File("C:\\audio\\stream-sample.wav");
AudioInputStream audioInputStream = null;
try {
audioInputStream = AudioSystem.getAudioInputStream(file);
} catch (UnsupportedAudioFileException | IOException e) {
e.printStackTrace();
}
AudioFormat format = audioInputStream.getFormat();
long frames = audioInputStream.getFrameLength();
@rahulduttt
rahulduttt / INSTALL
Created October 9, 2017 04:40 — forked from arya-oss/INSTALL.md
Ubuntu 16.04 Developer Tools installation
###### development tools
sudo apt-get install build-essential python-dev git nodejs-legacy npm gnome-tweak-tool openjdk-8-jdk
### Python packages
sudo apt-get install python-pip python-virtualenv python-numpy python-matplotlib
### pip packages
pip install django flask django-widget-tweaks django-ckeditor beautifulsoup4 requests classifier SymPy ipython
//setup
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});
// Actual ajax
$.post(submittarget,{data:data},function(e){
console.log(e);
});
@rahulduttt
rahulduttt / dash_trans_command.txt
Created April 3, 2017 20:56
Dash Transcode & Segment Command
FFMPEG to transcode:
ffmpeg -codec:a libvo_aacenc -ar 44100 -ac 1 -codec:v libx264 -profile:v baseline -level 13 -b:v 2000k output.mp4 -i test.mp4
MP4Box to segment:
MP4Box -dash 10000 -dash-profile live -segment-name output-seg output.mp4