Instantly share code, notes, and snippets.

View html-php-date-picker.php
<select name="year">
<option value="">Year</option>
<?php for ($year = date('Y'); $year > date('Y')-100; $year--) { ?>
<option value="<?php echo $year; ?>"><?php echo $year; ?></option>
<?php } ?>
</select>
<select name="month">
<option value="">Month</option>
<?php for ($month = 1; $month <= 12; $month++) { ?>
<option value="<?php echo strlen($month)==1 ? '0'.$month : $month; ?>"><?php echo strlen($month)==1 ? '0'.$month : $month; ?></option>
View vmstat-parser.php
<?php
// TEST
// $res[] = "procs -----------memory---------- ---swap-- -----io---- -system-- ----cpu----";
// $res[] = " r b swpd free buff cache si so bi bo in cs us sy id wa";
// $res[] = " 0 0 0 10376 148188 291056 0 0 4 29 85 9 1 0 98 1";
// // or
// // exec('vmstat', $res);
// print_r(parseVMStatOutput($res));
View SimpleICS.php
<?php /*
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
View NSBaseConversion.mm
/**
Original Code From, Md. Mahmud Ahsan, http://thinkdiff.net/mixed/base-conversion-handle-upto-36-bases/, 2008.02.28
Adapted Objective-C, Furkan Mustafa, 2013.05.28
Description: Alpha Numeric Base Conversion, Handles upto base 36
*/
NSString* reverseString(NSString* original) {
const char* chars = [original cStringUsingEncoding:NSASCIIStringEncoding];
int length = strlen(chars);
char* new = (char*)malloc(length+1);
View make-kernel-build-dir.sh
#!/bin/bash -e
#
# Extracted from: https://git.archlinux.org/svntogit/packages.git/tree/trunk/PKGBUILD?h=packages/linux
set -x
ARCH=$(uname -m)
KARCH=x86 # applies to x86_64 too (change for arm, etc.)
pkgdir=
View watch-video.sh
#!/bin/sh -e
#
# Public domain
# Author: roman [] tsisyk.com
# Modified By: furkan [] s2n.io 2014.10.19, added cache parameter and deleting cookie file
#
# Usage: ./me url [youtube-dl parameters]
#
TMPDIR=/tmp
View ghost-in-the-shell-ordered-list.txt
Ghost in the shell - Ordered list of Movie and Series
=====================================================
Original:
- Ghost in the Shell (1995/10)
- Ghost in the Shell 2: Innocence (2004/3)
- (Series) Ghost in the Shell: Stand Alone Complex (2002/10 .. 2003/10, 26 episodes)
View putio.sh
#!/bin/bash
PUTIO_USERNAME="your put.io username"
PUTIO_PASSWORD="your put.io password"
wget --http-user=${PUTIO_USERNAME} --http-password=${PUTIO_PASSWORD} --content-disposition -c $@
View NSDate+Formatters.h
/* f@s2n.io */
// DateFormat Reference : http://www.unicode.org/reports/tr35/tr35-25.html#Date_Format_Patterns
#import <Foundation/Foundation.h>
extern NSString* const DATEFORMAT_RFC3339;
@interface NSDate (FMDateFormatters)
+ (NSDate*)dateWithString:(NSString*)dateString format:(NSString*)format locale:(NSLocale*)locale timezone:(NSTimeZone*)zone;
View power-usage
#!/usr/bin/env python2
import os
def readfile(path):
f = open(path, 'r')
if not f:
return false
val = f.read()
f.close()
return val