Skip to content

Instantly share code, notes, and snippets.

@taxilian
taxilian / DialogManager.h
Created November 15, 2011 22:58
DialogManager abstraction for FireBreath
#ifndef DialogManager_h__
#define DialogManager_h__
#include <boost/noncopyable.hpp>
#include <boost/function.hpp>
#include "BrowserHost.h"
typedef boost::function<void (const std::string&)> PathCallback;
namespace FB { class PluginWindow; }
@Calrion
Calrion / README.md
Created December 8, 2011 04:32
Mount Stop Daemon (for Mac OS X)

Mount Stop Daemon

Mount Stop Daemon is a command-line utility for Mac OS X that prevents volumes from being automatically mounted. Any and all new volumes will not be automatically mounted while mountstopd is running.

Usage

@rjw57
rjw57 / CGSPrivate.h
Last active June 20, 2024 14:26
CGSPrivate.h - undocumented APIs for OSX. Re-licensed under MIT licence.
/* CGSPrivate.h -- Header file for undocumented CoreGraphics stuff. */
/* This file is a relicensed portion of DesktopManager and was originally released under
* the terms of the GNU General Public Licence. Original licence text follows the new terms.
* The contents of this file has been re-released by the original author under the following terms:
*
* Copyright (C) 2003, 2004, 2013 Richard J Wareham <richwareham@users.sourceforge.net>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this
* software and associated documentation files (the "Software"), to deal in the Software
@kbinani
kbinani / GetModuleFileName.cpp
Last active September 12, 2019 01:22
GetModuleFileName (WinAPI) equivalent implementation for OSX
#include <mach-o/dyld.h>
#include <mach-o/getsect.h>
#include <dlfcn.h>
#include <string>
std::string GetModuleFileName(const void *module)
{
if (!module) { return std::string(); }
uint32_t count = _dyld_image_count();
for (uint32_t i = 0; i < count; ++i) {
@daiakushi
daiakushi / GetBitLockerStatus.cpp
Last active September 11, 2023 06:58
Windows WMI Example to: 1. Get properties from WMI Class 2. Execute methods provided by WMI Class
#define _WIN32_DCOM
#include <iostream>
using namespace std;
#include <comdef.h>
#include <Wbemidl.h>
# pragma comment(lib, "wbemuuid.lib")
int main(int argc, char **argv)
{
@pilotmoon
pilotmoon / OS X Window Levels (10.10)
Last active November 1, 2019 06:01
OS X window levels
2015-01-16 10:09:00.037 WindowLevels[72050:11476115] 0 (kCGBaseWindowLevelKey) : -2147483648
2015-01-16 10:09:00.039 WindowLevels[72050:11476115] 1 (kCGMinimumWindowLevelKey) : -2147483643
2015-01-16 10:09:00.039 WindowLevels[72050:11476115] 2 (kCGDesktopWindowLevelKey) : -2147483623
2015-01-16 10:09:00.039 WindowLevels[72050:11476115] 3 (kCGBackstopMenuLevelKey) : -20
2015-01-16 10:09:00.039 WindowLevels[72050:11476115] 4 (kCGNormalWindowLevelKey) : 0
2015-01-16 10:09:00.040 WindowLevels[72050:11476115] 5 (kCGFloatingWindowLevelKey) : 3
2015-01-16 10:09:00.040 WindowLevels[72050:11476115] 6 (kCGTornOffMenuWindowLevelKey) : 3
2015-01-16 10:09:00.040 WindowLevels[72050:11476115] 7 (kCGDockWindowLevelKey) : 20
2015-01-16 10:09:00.040 WindowLevels[72050:11476115] 8 (kCGMainMenuWindowLevelKey) : 24
2015-01-16 10:09:00.040 WindowLevels[72050:11476115] 9 (kCGStatusWindowLevelKey) : 25
@jakoch
jakoch / unzip.iss
Created August 28, 2015 10:34
Unzip Helper for executing 7zip without blocking the InnoSetup GUI
{
Unzip Helper for executing 7zip without blocking the InnoSetup GUI
----
The main procedure is the non-blocking Unzip().
Your GUI will remain responsive during the unzip operation.
Written by Rik and Jens A. Koch (@jakoch) on StackOverflow:
http://stackoverflow.com/questions/32256432/how-to-execute-7zip-without-blocking-the-innosetup-ui
@matthewreagan
matthewreagan / gist:2f3a30b8b229e9e2aa7c
Last active November 8, 2022 23:34
Topmost window via CGWindow
NSWindow *topmostAppWindowAtPoint(CGPoint screenPoint)
{
const CGWindowLevel kScreensaverWindowLevel = CGWindowLevelForKey(kCGScreenSaverWindowLevelKey);
/* This function returns a pointer to the app's topmost NSWindow that
the point `screenPoint` is over. The important distinction here is that
this function takes _all_ system windows into consideration and will return
`nil` if there is a system window (or NSMenu etc.) that the cursor
is over which is atop the app window, which is information that
can't otherwise be gleaned by checking against `[NSApp orderedWindows]` etc.
@yamnikov-oleg
yamnikov-oleg / LICENSE
Last active May 9, 2024 04:56
Shared (interprocess) mutexes on Linux
MIT License
Copyright (c) 2018 Oleg Yamnikov
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@jakoch
jakoch / installer.iss
Created March 20, 2016 23:39
InnoSetup Uninstall by deleting the application folder
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
begin
// warn the user, that his working folder is going to be deleted and projects might get lost
if (CurUninstallStep = usUninstall) then begin
if MsgBox('***WARNING***'#13#10#13#10 +
'The installation folder is [ '+ ExpandConstant('{app}') +' ].'#13#10 +
'You are about to delete this folder and all its subfolders,'#13#10 +
'including [ '+ ExpandConstant('{app}') +'\important_projects_folder ], which may contain your projects.'#13#10#13#10 +