Skip to content

Instantly share code, notes, and snippets.

View kamel3d's full-sized avatar
💭
😎

Kamel Labiad kamel3d

💭
😎
View GitHub Profile
@karlkranich
karlkranich / apitest.php
Last active July 17, 2018 14:49
Updated PHP code to use the Google Sheets API. See usage instructions at http://karl.kranich.org/2015/04/16/google-sheets-api-php/ More examples at https://gist.github.com/karlkranich/afa39e3d778455b38c38
<?php
// apitest.php
// by Karl Kranich - karl.kranich.org
// 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
pudquick / example.applescript
Last active January 2, 2019 11:16
Example AppleScriptObjC / Cocoa-Applescript function for parsing hdiutil mount plist output via ObjC calls
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"
@stevederico
stevederico / LayerCakeScript
Created April 17, 2012 16:49
LayerCake Rename Layers Photoshop Script
//LayerCake Rename PhotoShop Script by Steve Derico http://www.stevederico.com
Credits:
// Rename Layers - Adobe Photoshop Script
// Requirements: Adobe Photoshop CS, or higher
// Description: renames and numbers all layers in the active document (using the supplied name pattern)
// Author: Trevor Morris (trevor@morris-photographics.com)
// Website: http://morris-photographics.com/
// ============================================================================
// Installation:
@sgr
sgr / workaround_the_iconservices_bug_mavericks.sh
Last active July 25, 2020 11:01
When "com.apple.IconServicesAgent" exhausts CPU resources on Mac OSX mavericks (10.9), you can try following workaround.
#!/bin/sh
mkdir ${TMPDIR}/com.apple.IconServices
@mnot
mnot / rename with date.applescript
Last active January 27, 2021 06:39
Applescript to rename a selected file, appending the current date
(*
Rename with Date 0.1
Copyright 2004 Mark Nottingham <mnot@mnot.net>
THIS SOFTWARE IS SUPPLIED WITHOUT WARRANTY OF ANY KIND, AND MAY BE
COPIED, MODIFIED OR DISTRIBUTED IN ANY WAY, AS LONG AS THIS NOTICE
AND ACKNOWLEDGEMENT OF AUTHORSHIP REMAIN.
*)
@xeoncross
xeoncross / google_doc_cms.php
Created April 1, 2013 20:03
Fetch a google doc, parse it, cache it, and display the content inside a webpage using PHP.
<?php
// Based on http://www.realisingdesigns.com/2009/10/29/using-google-docs-as-a-quick-and-easy-cms/
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');
}
@Voyz
Voyz / path_between_nulls.js
Created January 4, 2021 07:57
After Effects path between nulls
offset = [thisComp.width, thisComp.height]/2
p1 = thisComp.layer("P1").toComp([0,0]).slice(0,2) - offset
p2 = thisComp.layer("P2").toComp([0,0]).slice(0,2) - offset
t1 = thisComp.layer("T1").toComp([0,0]).slice(0,2) - offset - p1
t2 = thisComp.layer("T2").toComp([0,0]).slice(0,2) - offset - p2
ps = [p1, p2]
in_tangents = [[0,0], t2]
out_tangents = [t1, [0,0]]
createPath(ps, in_tangents, out_tangents, is_closed=false)
@walesmd
walesmd / IconServiceAgent.md
Last active December 13, 2023 05:06
A lot of people are having issues with com.apple.IconServicesAgent. 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 com.apple.quicklook. -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

@dale-c-anderson
dale-c-anderson / whois.php
Last active February 11, 2024 08:49
Simple PHP whois lookup script
<form method=GET action="<?php htmlentities(basename(_FILE_)); ?>">
<input type=text name="q" value="<?php echo htmlentities($_REQUEST["q"]); ?>">
<input type=submit value="WHOIS">
</form>
<pre><?php
/*
* whois.php
*/
main();
@oliveratgithub
oliveratgithub / Batch File Rename.scpt
Last active March 2, 2024 17:05
Simple AppleScript to easily batch rename multiple files sequentially. GUI asks user to select files and input a name before renaming.
-- This code comes from https://gist.github.com/oliveratgithub/
-- 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.