This file contains 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
sudo apt-get install imagemagick | |
convert -resize 50% source.png dest.jpg | |
convert -resize 1024X768 source.png dest.jpg | |
convert -resize 50% *.png |
This file contains 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.util.ArrayList; | |
public class Generics<Items> { | |
private ArrayList<Items> container = new ArrayList<Items>(); | |
public void fillContainer(Items item) { | |
container.add(item); | |
} | |
public void displayContents() { |
This file contains 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
#include <stdio.h> | |
int add(int, int); | |
int substract(int, int); | |
int perform(int (*doMath)(int, int), int a, int b) { | |
return doMath(a, b); | |
} |
This file contains 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.util.Iterator; | |
public class Iterators<Items> implements Iterable<Items>{ | |
private class Node { | |
Items item; | |
Node next; | |
} | |
private Node first = null; |
This file contains 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
public class CustomObject implements Comparable<CustomObject>{ | |
private int value; | |
public int compareTo(CustomObject that) { | |
if(this.value < that.value) | |
return -1; | |
else if(this.value > that.value) | |
return 1; | |
else | |
return 0; |
This file contains 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
// Comparable interface allows us to sort the objects according to the natural | |
// order. For example, you want to sort a bunch of strings. The natural order | |
// would be to sort them accroding to their Case sensitivity (Unicode). | |
// But what if you want to convey a message to the sort algorithm that you want | |
// to sort the strings in an case insensitive way. The way you do that is by using | |
// comparators. | |
// Alright, there are two entities here. | |
// An class which implements whose objects are to be compared. |
This file contains 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 threading | |
import time | |
def worker(num, squre): | |
print ("Worker number: " + str(num)) | |
print ("Squre of the thread number is " + str(squre)) | |
time.sleep(2) | |
print threading.currentThread().getName() | |
return |
This file contains 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
{ | |
"color_scheme": "Packages/Color Scheme - Default/Solarized (Light).tmTheme", | |
"draw_white_space": "all", | |
"font_size": 12, | |
"ignored_packages": | |
[ | |
], | |
"open_files_in_new_window": true, | |
"rulers": | |
[ |
This file contains 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
# .bashrc | |
# Insert this line above your prompt setting | |
function parse_git_branch { | |
git branch --no-color 2>/dev/null | grep \* | sed "s/\* \(.*\)/ (\1)/" | |
} | |
# Change your prompt from whatever it is (for example): | |
PS1='${USER}@${HOST}:${PWD} > ' | |
# To |
This file contains 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
################################################ | |
# What are decorators? | |
# Bascially a wrapper function, which modify the behaviour of a function, without | |
# changing the functionality of the original function. | |
# What problem do they actually solve? | |
# They alter the functionality of a function or a class. | |
################################################# | |
# Some original function, whose source we don't want to modify for some reason. |
OlderNewer