Skip to content

Instantly share code, notes, and snippets.

View rajat1saxena's full-sized avatar
😃
Building an open-source LMS

Rajat Saxena rajat1saxena

😃
Building an open-source LMS
View GitHub Profile
@rajat1saxena
rajat1saxena / studio.desktop
Created May 15, 2016 13:51
Android Studio - Ubuntu Launcher
[Desktop Entry]
Name=Android Studio 2
Comment=Official IDE for Android
Exec="/path/to/executable"
Icon="/path/to/icon"
Terminal=false
Type=Application
Categories=Development;IDE;Android;
StartupNotify=true
#!/bin/bash
# Get the IP of the connected android device
IP=`adb shell netcfg | grep wlan0 | awk '{ print $3 }' | awk -F'/' '{ print $1 }'`
# Port used for connecting, on device. Change as required
DEBUG_PORT='5555'
# Start the adb as tcpip deamon
adb tcpip $DEBUG_PORT
#So as not to be disturbed by Ctrl-S(XOFF) ctrl-Q(XON) in terminals:
stty -ixon
@rajat1saxena
rajat1saxena / soundreplace.sh
Created January 10, 2017 05:33
A quick shell script to replace the sound of your video
#!/bin/bash
VIDEO=$1
AUDIO=$2
DATE=`date +%Y-%m-%d.%H:%M:%S`
OUTPUT="Output_"$DATE".mp4"
ffmpeg -i $VIDEO -i $AUDIO \
-c:v copy -c:a aac -strict experimental \
-map 0:v:0 -map 1:a:0 $OUTPUT
@rajat1saxena
rajat1saxena / streams_basic_chunking.js
Created August 6, 2017 10:05
Efficiently write large files using Node.js
'use strict';
// this program will result in an "JavaScript heap out of memory"
const fs = require('fs');
const printer = function () {
const fil = fs.createWriteStream('file');
let i = 0;
const MAX_LIM = 1e6;
// Simple example to read a file line by line and multiply values by 2 and write
// to an output file
'use strict';
const stream = require('stream');
// const readStream = new ReadStream({
// read(size) {
// if ()
// }
// });
const fs = require('fs');
const http = require('http');
const server = http.createServer((req, res) => {
// res.setHeader('Content-Type', 'video/mp4');
const fil = fs.createReadStream('/home/rajat/Videos/apparchitecture.mp4');
const head2 = {
'Content-Type': 'video/mp4',
};
res.writeHead(200, head2);
@rajat1saxena
rajat1saxena / xhr_request.js
Created September 7, 2017 01:33
Send a XHR request
var xhr = new XMLHttpRequest();
xhr.responseType = 'json';
xhr.open("POST", "/graphql");
xhr.setRequestHeader("Content-Type", "application/json");
xhr.setRequestHeader("Accept", "application/json");
xhr.onload = function () {
console.log('data returned:', xhr.response);
}
xhr.send(JSON.stringify({query: "{ hello }"}));
<Calculator>
<DisplayWindow />
<NumPad>
<Key number={1}/>
<Key number={2}/>
.
.
.
<Key number={9}/>
</NumPad>
function Hello(props) {
return <div>{props.name}</div>
}