Skip to content

Instantly share code, notes, and snippets.

View gartmeier's full-sized avatar

Joshua Gartmeier gartmeier

  • Pitcher AG
  • Switzerland
View GitHub Profile
@gartmeier
gartmeier / Unzip
Last active December 31, 2015 05:29
Unzip archives with folders
// unzip if necessary
string ext = Path.GetExtension(fileItem.vUrl).ToLower();
if (ext.Equals(".zip"))
{
StorageFolder destinationFolder = await folder.CreateFolderAsync(Path.GetFileNameWithoutExtension(fileItem.vUrl), CreationCollisionOption.OpenIfExists);
Stream zipMemoryStream = await storageFile.OpenStreamForReadAsync();
// Create zip archive to access compressed files in memory stream
using (ZipArchive zipArchive = new ZipArchive(zipMemoryStream, ZipArchiveMode.Read))
{
// For each compressed file...
@gartmeier
gartmeier / ios.as
Created July 20, 2012 09:33
as3 check iOS device
if (Capabilities.os.indexOf('iPhone') > -1 || Capabilities.os.indexOf('iPad') > -1) {
// iOS
} else {
// other
}
@gartmeier
gartmeier / ipfw.sh
Created July 6, 2012 09:07
Mac FireWall (ipfw) Bandwidth Control Script
#!/bin/bash
SUDO_PASSWD='***'
echo $SUDO_PASSWD | sudo -S ipfw pipe 1 config bw $1kbit/s
echo $SUDO_PASSWD | sudo -S ipfw add pipe 1 dst-ip 0.0.0.0/0
read -p "hit enter to flush..." yn
echo $SUDO_PASSWD | sudo -S ipfw flush