Skip to content

Instantly share code, notes, and snippets.

@Aetet
Aetet / gist:2be9ff0745b3b4eb4ab3
Created September 16, 2015 21:31
capslock language switch with autohotkey
LOCALE_EN := 0x4090409
LOCALE_RU := 0x4190419
CapsLock::
if WinActive("ahk_class ConsoleWindowClass") {
PostMessage, 0x50, 0x02, 0,, A
}
else {
SetFormat, Integer, H
WinGet, WinID,, A
ThreadID := DllCall("GetWindowThreadProcessId", "UInt", WinID, "UInt", 0)
@jmfernandez
jmfernandez / lxc-unprivileged-HOWTO.md
Last active December 3, 2020 20:50
Unprivileged lxc containers with phyisical network (and boot with the host!)

Unprivilegedl lxc containers potentially provide higher security levels than privileged ones. But they also have some limitations, like it is not easy to start them on boot, or give them a public IP address. These instructions teach how to achieve these goals.

These instructions have been developed taking as base Ubuntu 14.04 and its packages. They can be adapted to other recent Linux distributions.

  1. Be sure you have installed lxc, bridge-utils, cgmanager-utils and cgroup-bin packages:

    apt-get install apt-get install lxc bridge-utils cgmanager-utils cgroup-bin
  2. Protect access to host dmesg, so in case of a compromised container it does not give clues about the host.

@aras-p
aras-p / preprocessor_fun.h
Last active May 3, 2025 13:47
Things to commit just before leaving your job
// Just before switching jobs:
// Add one of these.
// Preferably into the same commit where you do a large merge.
//
// This started as a tweet with a joke of "C++ pro-tip: #define private public",
// and then it quickly escalated into more and more evil suggestions.
// I've tried to capture interesting suggestions here.
//
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_,
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant,
@willurd
willurd / web-servers.md
Last active May 4, 2025 11:11
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000