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
#!/bin/sh | |
for i in *.svg | |
do | |
IFS='.' read -a array <<< "$i" | |
inkscape -f "$i" -e "${array[0]}.png" | |
rm $i |
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
#!/bin/bash | |
for PNG in $(find . -name '*.png'); do | |
pngquant -ext .png -force 256 ${PNG} | |
echo "Optimized PNG: ${PNG}" | |
done |
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 npm cache clean -f | |
sudo npm install -g n | |
sudo n stable #updates to the latest stable version |
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 boolean isNetworkConnected() { | |
// get Connectivity Manager to get network status | |
ConnectivityManager connMgr = (ConnectivityManager) | |
getSystemService(Context.CONNECTIVITY_SERVICE); | |
NetworkInfo networkInfo = connMgr.getActiveNetworkInfo(); | |
if (networkInfo != null && networkInfo.isConnected()) { | |
return true; //we have a connection | |
} else { |
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
//Determine screen density | |
DisplayMetrics metrics = new DisplayMetrics(); | |
getWindowManager().getDefaultDisplay().getMetrics(metrics); | |
int density = metrics.densityDpi; | |
if (density == DisplayMetrics.DENSITY_TV) { | |
Toast.makeText(this, "DENSITY_TV... Density is " + String.valueOf(density), Toast.LENGTH_LONG).show(); | |
} | |
else if (density == DisplayMetrics.DENSITY_XXXHIGH) { | |
Toast.makeText(this, "DENSITY_XXXHIGH... Density is " + String.valueOf(density), Toast.LENGTH_LONG).show(); |
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
NSString *key; | |
for(key in dict){ | |
NSLog(@"Key: %@, Value %@", key, [dict objectForKey: key]); | |
} |
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
#!/bin/bash | |
echo "The following hard disks are currently present in your system:" | |
for DISK in /dev/sda /dev/sdb /dev/sdc /dev/sdd | |
do | |
echo "The disk $DISK appears to have `fdisk -l $DISK 2> /dev/null | grep -E $DISK\[0-9]\ | wc -l` partitions." | |
done |