This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.io.BufferedOutputStream; | |
| import java.io.BufferedWriter; | |
| import java.io.IOException; | |
| import java.io.InputStream; | |
| import java.io.OutputStream; | |
| import java.io.OutputStreamWriter; | |
| import java.io.PrintWriter; | |
| import java.io.Writer; | |
| import java.util.ArrayList; | |
| import java.util.Arrays; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.io.BufferedOutputStream; | |
| import java.io.BufferedWriter; | |
| import java.io.IOException; | |
| import java.io.InputStream; | |
| import java.io.OutputStream; | |
| import java.io.OutputStreamWriter; | |
| import java.io.PrintWriter; | |
| import java.io.Writer; | |
| import java.util.ArrayList; | |
| import java.util.Arrays; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.io.BufferedOutputStream; | |
| import java.io.BufferedWriter; | |
| import java.io.IOException; | |
| import java.io.InputStream; | |
| import java.io.OutputStream; | |
| import java.io.OutputStreamWriter; | |
| import java.io.PrintWriter; | |
| import java.io.Writer; | |
| import java.util.ArrayList; | |
| import java.util.Arrays; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.io.BufferedOutputStream; | |
| import java.io.BufferedWriter; | |
| import java.io.IOException; | |
| import java.io.InputStream; | |
| import java.io.OutputStream; | |
| import java.io.OutputStreamWriter; | |
| import java.io.PrintWriter; | |
| import java.io.Writer; | |
| import java.util.ArrayList; | |
| import java.util.Arrays; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Recursive Backtracking: | |
| usually involves a for loop + a recursion. (the for loop acts as a backtracking mechanism) | |
| The requirements for a recursive solution are met in these ways. | |
| .The problem is made smaller by taking one step in the space - by making one move. | |
| .The base case occurs when the property has been fully satisfied and we arrive at the exit. | |
| .The partial results are combined by putting the steps together in a way that is appropriate (perhaps printing them, or returning them as a list to some other program). | |
| *important things to note: The base case is *usually* the solution to the problem. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| AngularJS: $watch, $digest and $apply | |
| Some Guidelines For Use: | |
| $watch | |
| DO use $watch in directives to update the DOM when a $scope value changes. | |
| DON'T use $watch in a controller. It's hard to test and completely unnecessary in almost every case. Use a method on the scope to update the value(s) the watch was changing instead. | |
| $digest/$apply | |
| DO use $digest/$apply in directives to let Angular know you've made changes after an asynchronous call, such as a DOM event. | |
| DO use $digest/$apply in services to let Angular know some asynchronous operation has returned, such as a WebSocket update, or an event from a 3rd party library like Facebook API. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/python | |
| import sys | |
| import os | |
| import datetime | |
| from subprocess import Popen, PIPE, call | |
| from datetime import date, datetime, date, time | |
| """ | |
| Sends out an email via the unix mail command, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import sys | |
| import os | |
| import time | |
| from datetime import datetime | |
| import urllib2 | |
| """ | |
| Use this function to allow applications to communicate via HTTP to the internet | |
| """ | |
| def setProxy(): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ### How to change permissions of all files in a dir using XARGS | |
| [root@abc installers]# ls | xargs -Ifile chmod 777 file | |
| [root@abc installers]# ls -rlt | |
| total 446676 | |
| -rwxrwxrwx 1 abc abc 30537780 Oct 8 08:18 hcatalog-0.11.0.1.3.2.0-111.tar.gz | |
| -rwxrwxrwx 1 abc abc 14492759 Oct 8 08:20 Python-2.7.5.tgz | |
| [root@abc installers]# ls | xargs -I{} chmod 777 {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Use Gists to store code you would like to remember later on | |
| console.log(window); // log the "window" object to the console |