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
from django.views import View | |
from django.http import HttpResponse | |
MIMETYPES = { | |
'ps': 'application/postscript', | |
'eps': 'application/postscript', | |
'pdf': 'application/pdf', | |
'svg': 'image/svg+xml', | |
'png': 'image/png', | |
'jpeg': 'image/jpeg', |
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 Fibonacci{ | |
public static int fibTopDown(int n, int [] fib) { | |
if(n==0) return 0; | |
if(n==1) return 1; | |
if(fib[n]!=0){ | |
return fib[n]; | |
}else{ | |
fib[n] = fibTopDown(n-1, fib) + fibTopDown(n-2, fib); | |
return fib[n]; | |
} |
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
private static WritableMap convertJsonToMap(JSONObject jsonObject) throws JSONException { | |
WritableMap map = new WritableNativeMap(); | |
Iterator<String> iterator = jsonObject.keys(); | |
while (iterator.hasNext()) { | |
String key = iterator.next(); | |
Object value = jsonObject.get(key); | |
if (value instanceof JSONObject) { | |
map.putMap(key, convertJsonToMap((JSONObject) value)); | |
} else if (value instanceof JSONArray) { |
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
#!/usr/bin/env bash | |
func_check_for_root() { | |
if [ ! $( id -u ) -eq 0 ]; then | |
echo "ERROR: $0 Must be run as root, Script terminating" ;exit 7 | |
fi | |
} | |
func_check_for_root | |
#SETUP PARAMS |