Skip to content

Instantly share code, notes, and snippets.

View furkanmustafa's full-sized avatar
💭
Set your status

Furkan Mustafa furkanmustafa

💭
Set your status
View GitHub Profile
@furkanmustafa
furkanmustafa / play-random-music.sh
Last active August 4, 2023 19:17
A simple script to play random mp3s in a folder
#!/bin/bash -e
PLAYER="mpv -vo null"
#PLAYER="mpg321"
MUSIC=$(find . -regextype posix-extended -iregex '.*(m4a|mp3|mp4|aac)$' | sort -R)
IFS=$'\n'
for file in $MUSIC
@furkanmustafa
furkanmustafa / SimpleICS.php
Last active May 16, 2023 12:42
Simple ICS Generation class for 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.
@furkanmustafa
furkanmustafa / html-php-date-picker.php
Created January 27, 2013 15:34
Date Picker Select Generator for HTML & 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>
@furkanmustafa
furkanmustafa / watch-video.sh
Last active January 11, 2020 01:42
Simple script to watch streaming videos with mpv and youtube-dl
#!/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
@furkanmustafa
furkanmustafa / putio.sh
Last active June 2, 2019 20:38
Simple Bash Script to download files from your put.io accountUsage: putio.sh "https://put-io-download-link"
#!/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 $@
@furkanmustafa
furkanmustafa / NSBaseConversion.mm
Created May 28, 2013 02:00
Objective-C Base Conversion
/**
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);
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)
@furkanmustafa
furkanmustafa / vmstat-parser.php
Created February 7, 2013 16:35
PHP Function for parsing vmstat output
<?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));
@furkanmustafa
furkanmustafa / make-kernel-build-dir.sh
Created October 10, 2017 21:23
Script to generate /lib/modules/`uname -r`/build directory
#!/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=
@furkanmustafa
furkanmustafa / NSDate+Formatters.h
Last active June 13, 2017 20:11
a few NSDateFormatter helpers for Objective-C
/* 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;