Skip to content

Instantly share code, notes, and snippets.

View crmne's full-sized avatar
👋

Carmine Paolino crmne

👋
View GitHub Profile
@crmne
crmne / snap-graph_warning.patch
Created May 26, 2011 08:22
Fix for invalid preprocessor directive #warn in snap-graph.sf.net
Index: src/graph_partitioning/internal-timer.h
===================================================================
--- src/graph_partitioning/internal-timer.h (revision 187)
+++ src/graph_partitioning/internal-timer.h (working copy)
@@ -30,7 +30,7 @@
static struct timespec tic_ts;
#define USE_CLOCK_GETTIME
#else
-#warn "Falling back to gettimeofday ()."
+#warning "Falling back to gettimeofday ()."
@crmne
crmne / emacs-colors.patch
Created May 30, 2011 15:29
Fixes Emacs colors on Mac OS X
diff --git a/src/nsterm.m b/src/nsterm.m
index 025486d..bb362a6 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -1414,7 +1414,7 @@ ns_get_color (const char *name, NSColor **col)
if (r >= 0.0)
{
- *col = [NSColor colorWithCalibratedRed: r green: g blue: b alpha: 1.0];
+ *col = [NSColor colorWithDeviceRed: r green: g blue: b alpha: 1.0];
@crmne
crmne / emacs23_3-xcode4.patch
Created June 7, 2011 16:28
Fixes Emacs 23.3 compilation bug when using Xcode 4
diff --git a/src/unexmacosx.c b/src/unexmacosx.c
index df4c0da..e5254de 100644
--- a/src/unexmacosx.c
+++ b/src/unexmacosx.c
@@ -822,6 +822,7 @@ copy_data_segment (struct load_command *lc)
}
else if (strncmp (sectp->sectname, "__la_symbol_ptr", 16) == 0
|| strncmp (sectp->sectname, "__nl_symbol_ptr", 16) == 0
+ || strncmp (sectp->sectname, "__got", 16) == 0
|| strncmp (sectp->sectname, "__la_sym_ptr2", 16) == 0
# Script to process background data (.ibs files) generated by the Optotrak 3020 system
# Carmine Paolino <carmine@paolino.me>
require 'csv'
num_pattern = /[+-]?\d*\.?\d+/
allowed_frenquencies = [ 1, 2.5, 4 ]
trials = []
class ListableAccessors
@crmne
crmne / Google Translate.scpt
Last active May 15, 2018 18:06
UPDATE: I made a LaunchBar 6 action that you can find here: http://static.paolino.me/GoogleTranslate.lbaction.zip. Make sure to enable Accessibility for LaunchBar, and "Allow Javascript from Apple Events" in Safari's Develop menu. -- Translates text using Google Translate in Safari. It gracefully handles large text, which is impossible with just…
on safari_is_ready(docNum, interval)
repeat
tell application "Safari"
try
do JavaScript "document.readyState" in document docNum
set readyState to result
set finishedLoading to (source of document docNum contains "</html>")
if finishedLoading and readyState is "Complete" then exit repeat
end try
end tell
@crmne
crmne / Convert Currency.scpt
Last active April 13, 2018 10:47
Converts currencies using Google Finance. Created specifically for LaunchBar, just put it in `~/Library/Application Support/LaunchBar/Actions`. It accepts input in this form: `<amount> <from currency> […] <to currency>`. So for example all of those strings will result in the same conversion: "60 gbp to eur" "60 gbp in eur" "60 gbp eur". It will …
on parse_input_string(theString)
set AppleScript's text item delimiters to " "
set theFromAmount to text item 1 of theString as text
if length of text items of theString is greater than 1 then
set theFromCurrency to text item 2 of theString as text
set theToCurrency to text item -1 of theString as text
set currenciesGiven to true
else
set theFromCurrency to "USD"
set theToCurrency to "EUR"
@crmne
crmne / iTunes - Current Track.scpt
Created May 11, 2014 14:56
Gets the name, artist and album of the current playing track in iTunes and passes it to Launchbar. Very useful to search the current track in Google, Discogs, and the likes.
on replace_chars(this_text, search_string, replacement_string)
set AppleScript's text item delimiters to the search_string
set the item_list to every text item of this_text
set AppleScript's text item delimiters to the replacement_string
set this_text to the item_list as string
set AppleScript's text item delimiters to ""
return this_text
end replace_chars
set myTrack to ""
@crmne
crmne / SafariPowerSaverWhitelister.scpt
Created May 12, 2014 11:02
A tool to add websites to Safari Power Saver's whitelist.
on number_to_string(this_number)
set this_number to this_number as string
if this_number contains "E+" then
set x to the offset of "," in this_number
set y to the offset of "+" in this_number
set z to the offset of "E" in this_number
set the decimal_adjust to characters (y - (length of this_number)) thru ¬
-1 of this_number as string as number
if x is not 0 then
set the first_part to characters 1 thru (x - 1) of this_number as string
commit 3762f3baeef518496d8c04b9d44836bc7ec85c81
Author: gperciva <gperciva@0e98fd9d-079e-457f-9c5c-d482923f975d>
Date: Fri Feb 1 00:30:39 2013 +0000
Improve doc building
git-svn-id: svn+ssh://svn.code.sf.net/p/marsyas/code/trunk@5076 0e98fd9d-079e-457f-9c5c-d482923f975d
diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt
@crmne
crmne / download_zeal_user_docsets.py
Last active June 6, 2022 08:37
A solution to the lack of UI for Dash's user docsets in Zeal. Uses Python 3 and easygui (pip3 install easygui)
"""Download Dash User Docsets and install them in Zeal"""
import configparser
import json
import tarfile
import urllib.request
from pathlib import Path
from sys import platform
import easygui