This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Cu.import('resource://gre/modules/ctypes.jsm'); | |
function doit() { | |
try { | |
_x11 = ctypes.open('libX11.so.6'); | |
} catch (e) { | |
try { | |
var libName = ctypes.libraryName('X11'); | |
} catch (e) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <sys/types.h> | |
#include <unistd.h> | |
#include <fcntl.h> | |
#include <stdio.h> | |
int main() { | |
int fd; | |
struct flock lock, savelock; | |
printf("F_GETLK: %d\n", F_GETLK); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Cu.import('resource://gre/modules/ctypes.jsm'); | |
var lib = { | |
user32: ctypes.open('user32.dll') | |
} | |
var NULL = ctypes.cast(ctypes.uint64_t(0x0), ctypes.voidptr_t); | |
/* http://msdn.microsoft.com/en-us/library/ms633514%28VS.85%29.aspx | |
* HWND WINAPI GetTopWindow( | |
* __in_opt_ HWND hWnd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void *EventLoop(void *args) | |
{ | |
int state; | |
pthread_setcancelstate (PTHREAD_CANCEL_ENABLE, &state); | |
pthread_setcanceltype (PTHREAD_CANCEL_ASYNCHRONOUS, &state); | |
// In one thread run the event loop to get hotkey presses | |
EventHotKeyID gMyHotKeyID1, gMyHotKeyID2; | |
EventTypeSpec eventType; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var getScope = function(aAddonId) { var XPIScope = Cu.import('resource://gre/modules/addons/XPIProvider.jsm'); return XPIScope.XPIProvider.activeAddons.get(aAddonId).bootstrapScope; }; a = getScope('MouseControl@jetpack'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Cocoa | |
class AXWindow { | |
let app: AXUIElement | |
let window: AXUIElement | |
init(app: AXUIElement, window: AXUIElement) { | |
self.app = app | |
self.window = window |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*! | |
* isSemVer - v0.1 - 9/05/2010 | |
* http://benalman.com/ | |
* http://semver.org/ | |
* | |
* Copyright (c) 2010 "Cowboy" Ben Alman | |
* Dual licensed under the MIT and GPL licenses. | |
* http://benalman.com/about/license/ | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
#include <stdio.h> | |
#include <ctype.h> | |
#include <signal.h> | |
#include <string.h> | |
#include <unistd.h> // for usleep() only | |
#include <sys/time.h> | |
#include <sys/types.h> | |
#include <time.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
function toDecimal(A) { | |
var sum = 0; | |
for (var i = 0; i < A.length; i++) { | |
sum += A[i] * Math.pow(-2, i); | |
} | |
return sum; | |
} |