Skip to content

Instantly share code, notes, and snippets.

View dacap's full-sized avatar
🎨
Programming

David Capello dacap

🎨
Programming
View GitHub Profile
@dacap
dacap / MouseWheelVolume.ahk
Created August 2, 2011 00:39
Change volume with mouse wheel over task bar
#If MouseIsOver("ahk_class Shell_TrayWnd")
WheelUp::Send {Volume_Up}
WheelDown::Send {Volume_Down}
MouseIsOver(WinTitle) {
MouseGetPos,,, Win
return WinExist(WinTitle . " ahk_id " . Win)
}
@dacap
dacap / AlwaysOnTop.ahk
Created December 13, 2011 02:10
AutoHotKey script for "Google Chrome - Always on top"
#o::
WinSet, Alwaysontop, , A
WinGet, ExStyle, ExStyle, A
if (ExStyle & 0x8) ; 0x8 is WS_EX_TOPMOST
{
WinSet, Transparent, 204, A
}
else
{
@dacap
dacap / gist:2151790
Created March 21, 2012 19:34
Pseudo-code to show closures
// The following function, "Calculate_average", will be the only
// public function in your library API
FUNCTION Calculate_average ( N1, N2, ..., NN )
LOCAL VARIABLE sum = 0
LOCAL VARIABLE count = 0
// Define a function named "sum_and_count" that isn't public API of your library,
// this function is visible and usable only inside "Calculate_average"
LOCAL FUNCTION sum_and_count(x)
sum = sum + x // The key of closures: here we can modify variables that are not in the scope of sum_and_count()
@dacap
dacap / gist:2155047
Created March 22, 2012 01:35
More closure magic in pseudo-code
// Holly crap! Now we can give the "sum_and_count" function as a parameter.
FUNCTION Calculate_average ( sum_and_count, N1, N2, ..., NN )
LOCAL VARIABLE sum = 0
LOCAL VARIABLE count = 0
FOR_EACH N = N1, N2, ..., NN
CALL_THE_FOLLOWING_FUNCTION sum_and_count ( N )
RETURN num / count
END FUNCTION
@dacap
dacap / emacs-c++key-stats.txt
Created May 23, 2012 23:38
dacap's key stats 2012-05-23
950054 16.84% self-insert-command
756545 13.41% next-line
675163 11.97% previous-line
...
213058 3.78% move-beginning-of-line
201271 3.57% subword-forward
...
101016 1.79% subword-backward
97459 1.73% c-forward-subword
94503 1.68% backward-sexp
@dacap
dacap / test.cpp
Created June 12, 2012 02:00
Emacs C++ navigation test
namespace my_namespace {
void func1() {
}
void func2() {
}
class MyClass {
public:
#include <iostream>
#include "miniapp/miniapp.h"
using namespace miniapp;
int main()
try {
Window w;
w.on_paint = [](Canvas& canvas) {
canvas.fill_rect(rgb(255, 255, 255), Rect(0, 0, 255, 255));
@dacap
dacap / create-vms.ps1
Last active August 29, 2015 14:15
Azure SSH Broken pipe at East US 2
azure network reserved-ip create vmname1-reserved-ip "West Europe"
azure vm create `
--location "West Europe" `
--userName username `
--ssh 22 `
--ssh-cert mypublickey.pem `
--no-ssh-password `
--reserved-ip vmname1-reserved-ip `
--vm-size Small `
--vm-name vmname1 `
tab-text-color: #000000;
tab-background {
slice: sheet.png 0 0 16 16;
}
tab-close-icon {
slice: sheet.png 16 0 16 16;
}
// Don't modify, generated file from /aseprite/data/pref.xml
#ifndef GENERATED_PREF_TYPES_H_INCLUDED
#define GENERATED_PREF_TYPES_H_INCLUDED
#pragma once
#include <string>
namespace app {
namespace gen {