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
@prashanta
prashanta / pssh.py
Created January 21, 2010 07:05
SSH connection from Python
import paramiko
import string
import webbrowser
import os
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect('192.168.1.21', username='username', password='password')
print "1: get file \n2: print contents of file"
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];
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 / 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
@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 / 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 / collection.md
Last active January 7, 2022 23:20
Collection of shell commands/scripts

Common Linux Commands

Contained here are trival stuffs. Like with all trival stuffs, its inevitably bound to be forgotten.

Description Command
List only directories ls -l | grep ^d
Count number of files & directories ls -l | tail +2 | wc -l
Command prompt coloring__ (Add to ~/.bash_profile) \n Color reference here export PS1="\e[36;1m[\W] \e[0m"
Colorizing terminal (Add to ~/.bash_profile) export CLICOLOR=1 \n export LSCOLORS=gacadxFxCxDxBxegedabagace