Skip to content

Instantly share code, notes, and snippets.


Kamel Labiad kamel3d

View GitHub Profile
View reuters-rss.txt
dale-c-anderson / whois.php
Last active Jun 27, 2021
Simple PHP whois lookup script
View whois.php
<form method=GET action="<?php htmlentities(basename(_FILE_)); ?>">
<input type=text name="q" value="<?php echo htmlentities($_REQUEST["q"]); ?>">
<input type=submit value="WHOIS">
* whois.php
karlkranich / apitest.php
Last active Jul 17, 2018
Updated PHP code to use the Google Sheets API. See usage instructions at More examples at
View apitest.php
// apitest.php
// by Karl Kranich -
// version 3.1 - edited query section
require_once realpath(dirname(__FILE__) . '/vendor/autoload.php');
include_once "google-api-php-client/examples/templates/base.php";
$client = new Google_Client();
pudquick / example.applescript
Last active Jan 2, 2019
Example AppleScriptObjC / Cocoa-Applescript function for parsing hdiutil mount plist output via ObjC calls
View example.applescript
script AppDelegate
property parent: class "NSObject"
-- Syntax sugar
property myApp: current application
property None: missing value -- Be careful not to bind this as a IBOutlet!
-- Classes
property NSData: myApp's class "NSData"
property NSString: myApp's class "NSString"
mandiwise / Count lines in Git repo
Last active Jul 21, 2021
A command to calculate lines of code in all tracked files in a Git repo
View Count lines in Git repo
// Reference:
$ git ls-files | xargs wc -l
oliveratgithub / Batch File Rename.scpt
Last active May 15, 2021
Simple AppleScript to easily batch rename multiple files sequentially. GUI asks user to select files and input a name before renaming.
View Batch File Rename.scpt
-- This code comes from
-- Open in AppleScript Editor and save as Application
-- ------------------------------------------------------------
--this is required to break the filename into pieces (separate name and extension)
set text item delimiters to "."
tell application "Finder"
set all_files to every item of (choose file with prompt "Choose the Files you'd like to rename:" with multiple selections allowed) as list
display dialog "New file name:" default answer ""
set new_name to text returned of result
--now we start looping through all selected files. 'index' is our counter that we initially set to 1 and then count up with every file.
sgr /
Last active Jul 25, 2020
When "" exhausts CPU resources on Mac OSX mavericks (10.9), you can try following workaround.
mkdir ${TMPDIR}/
walesmd /
Last active May 21, 2021
A lot of people are having issues with Since this is a very new issue, Google was no help and `man iconservicesd` is even more hilarious. I eventually fixed it, when I was working on a completely different issue (that is still not fixed). The instructions are below and on the Apple Support Forum, https://discussions.…

I was chasing down another issue (slow "Save As") and thought these two issues may have been related (with QuickLook being the common broken link). Unfortunately, my "Save As" dialog is still miserably slow on the initial load; but IconServicesAgent hasn't gone above 30MB and he rarely makes an appearance in the Console!

Some of these steps may not be necessary, but here are all of the steps I took that inadverdently put IconServicesAgent back in its place. Note: all commands are a single-line, if they appear to be multiple that's just the forum formatting.

  1. Check for any QuickLooks related .plist files. In a terminal: mdfind -name .plist

  2. I only had files at the system level (specifically within /System/Library/LaunchAgents/). If you have others, modify the directions below to take that into account (re-introducing plist files from the system level back up to the user).

  3. Make some temporary directories to store these plist files, just in case: mkdir ~/tmp-quicklook

Xeoncross / google_doc_cms.php
Created Apr 1, 2013
Fetch a google doc, parse it, cache it, and display the content inside a webpage using PHP.
View google_doc_cms.php
// Based on
function getUrl($url, $expires = 5)
$cache_file = __DIR__ . '/cache/' . preg_replace('~\W+~', '-', $url) . '.txt';
if( ! is_dir(__DIR__ . '/cache') AND ! mkdir(__DIR__ . '/cache')) {
die('Please create /cache directory');
nikcub /
Created Oct 4, 2012
Facebook PHP Source Code from August 2007