Skip to content

Instantly share code, notes, and snippets.

View prashanta's full-sized avatar
🚀

Prashanta Shrestha prashanta

🚀
View GitHub Profile
$ sudo aptitude update && sudo aptitude install gnome-do
javascript:(function(){ window.open('https://mail.google.com/tasks/canvas','myWindow', 'status=1, height=600,width=600,resizable = 0,location=0'); })();
# Python script to find missing lines from two different files
import sys
import string
if len(sys.argv) < 4:
print "Usage: findmissing.py <master-file> <test-file> <result-file>"
sys.exit()
else:
file1 = sys.argv[1];
@prashanta
prashanta / Terminal-Finder-Switcher
Created July 4, 2010 22:29
Switching between Terminal and Finder
set a to item 1 of getFrontApp()
if a contains "Finder" then
tell application "Finder"
set the_folder to (folder of the front window) as text
set the_folder to POSIX path of the_folder
set the_folder to (do shell script "echo " & the_folder & " | sed 's/ /\\\\ /g'")
end tell
tell application "Terminal"
do script "cd " & the_folder & ";clear;pwd"
activate
set applist to getFrontApp()
-- screen resolution
set screen to {1280, 800}
set menubar to getMenuSize()
set dock to getDockSize()
set a to item 1 of getFrontApp()
set t to (item 2 of menubar)
set l to 0
set h to 600
@prashanta
prashanta / googletalkwindow.js
Created August 16, 2010 05:27
Google Talk on a pop-up window
javascript:(function(){%20window.open('http://talkgadget.google.com/talkgadget/popout','myWindow',%20'status=1,%20height=600,width=400,resizable%20=%200,location=0');%20})();
@prashanta
prashanta / SerialRelay.ino
Created October 11, 2012 12:05
Data relay between two USARTs of an Arduino
#include <SoftwareSerial.h>
SoftwareSerial mySerial = SoftwareSerial(10, 11);; // RX, TX
void setup() {
pinMode(10,INPUT);
pinMode(11,OUTPIT);
mySerial.begin(19200);// this connects to the other USART device
Serial.begin(19200); // this one connects to a computer via USB
while (!Serial) {
@prashanta
prashanta / default.js
Last active June 3, 2016 08:00
Reusing ES6 React Component on Server Side (yup, node.js does not support ES6 yet, so this is a hack using Babel)
var express = require('express');
var router = express.Router();
var babel = require("babel-core");
var React = require('react');
// Get ReactDOMServer for server side rendering
var ReactDOMServer = require('react-dom/server');
// Compile code transformed by babel.transformFileSysnc
module._compile(babel.transformFileSync('./public/js/components/header.js').code);
// Save it to a accessible header before moudle.exports gets replaaced
@prashanta
prashanta / index.html
Last active August 2, 2016 03:51
Show User Location
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<style type="text/css">
html { height: 100% }
body { height: 100%; margin: 0; padding: 0 }
#map_canvas {
position: absolute;
width: 100%;
@prashanta
prashanta / reoccurring-git-commands.md
Last active August 3, 2016 04:26
Reoccurring Git Commands

Some reoccurring git commands

  • Graphical git log

    git log --graph --oneline --decorate

  • Difference between local file and remote

    git diff origin/master path/to/file.ext