Skip to content

Instantly share code, notes, and snippets.

View ehabkost's full-sized avatar

Eduardo Habkost ehabkost

View GitHub Profile
Searching 6027 files for "^( +)[^ \n][^\n][^\n][^\n][^\n][^\n][^\n][^(\n][^(\n][^(\n][^\n]*= *\n\1 [^ ]" (regex)
qemu/block.c:
3762 static void bdrv_aio_cancel_em(BlockDriverAIOCB *blockacb)
3763 {
3764: BlockDriverAIOCBSync *acb =
3765: container_of(blockacb, BlockDriverAIOCBSync, common);
3766 qemu_bh_delete(acb->bh);
3767 acb->bh = NULL;
....
Searching 6027 files for "^( +)[^ \n][^\n][^\n][^\n][^\n][^\n][^\n][^(\n][^(\n][^(\n][^\n]*= *\n\1 [^ ]" (regex)
qemu/qemu-char.c:
837 static void cfmakeraw (struct termios *termios_p)
838 {
839: termios_p->c_iflag &=
840: ~(IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON);
841 termios_p->c_oflag &= ~OPOST;
842 termios_p->c_lflag &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN);
# usage: sed -i -f cpu-feature-array.sed $(git grep -E -l -- '->cpuid_|CPUX86State')
s/\(env->\|env\.\|cpu->\|def->\|def\.\|^ *\.\)\(cpuid_\)*ext_features\([^\[]\|$\)/\1features[FEAT_1_ECX]\3/g
s/\(env->\|env\.\|cpu->\|def->\|def\.\|^ *\.\)\(cpuid_\)*ext2_features\([^\[]\|$\)/\1features[FEAT_8000_0001_EDX]\3/g
s/\(env->\|env\.\|cpu->\|def->\|def\.\|^ *\.\)\(cpuid_\)*ext3_features\([^\[]\|$\)/\1features[FEAT_8000_0001_ECX]\3/g
s/\(env->\|env\.\|cpu->\|def->\|def\.\|^ *\.\)\(cpuid_\)*ext4_features\([^\[]\|$\)/\1features[FEAT_C000_0001_EDX]\3/g
s/\(env->\|env\.\|cpu->\|def->\|def\.\|^ *\.\)\(cpuid_\)*kvm_features\([^\[]\|$\)/\1features[FEAT_KVM]\3/g
s/\(env->\|env\.\|cpu->\|def->\|def\.\|^ *\.\)\(cpuid_\)*svm_features\([^\[]\|$\)/\1features[FEAT_SVM]\3/g
s/\(env->\|env\.\|cpu->\|def->\|def\.\|^ *\.\)\(cpuid_\)*7_0_ebx_features\([^\[]\|$\)/\1features[FEAT_7_0_EBX]\3/g
s/\(env->\|env\.\|cpu->\|def->\|def\.\|^ *\.\)\(cpuid_\)*features\([^\[]\|$\)/\1features[FEAT_1_EDX]\3/g
@ehabkost
ehabkost / block.h
Created November 14, 2012 16:05
typedef + header dependencies
typedef struct BDRVReopenState {
BlockDriverState *bs;
int flags;
void *opaque;
} BDRVReopenState;
void bdrv_iostatus_enable(BlockDriverState *bs);
void bdrv_iostatus_reset(BlockDriverState *bs);
void bdrv_iostatus_disable(BlockDriverState *bs);
@ehabkost
ehabkost / cpudef-to-c.py
Created August 1, 2012 18:33
Script to convert QEMU cpudefs to C
#!/usr/bin/env python
import re
feature_names = {
'': [
"fpu", "vme", "de", "pse",
"tsc", "msr", "pae", "mce",
"cx8", "apic", None, "sep",
"mtrr", "pge", "mca", "cmov",
"pat", "pse36", "pn", "clflush",
@ehabkost
ehabkost / gist:3061695
Created July 6, 2012 18:05 — forked from melissaboiko/crep
simple script to color matching lines (like grep --color, but also prints non-matching lines)
#!/bin/bash
pname="$(basename $0)"
function usage()
{
echo "Usage: $pname [OPTIONS] PATTERN [FILES and/or GREP_OPTIONS...]
Colorize all matches for PATTERN, an extended regular expression.
Non-matching lines are still printed.
@ehabkost
ehabkost / keymap-debugging.patch
Created June 23, 2012 18:30
keymap loading debugging patch
From a88cd3fb96e8c53853e65f58a7ef6105cda70341 Mon Sep 17 00:00:00 2001
From: Eduardo Habkost <ehabkost@raisama.net>
Date: Sat, 23 Jun 2012 15:20:42 -0300
Subject: [PATCH] extra debug messages to debug dead key handing on OS X
Signed-off-by: Eduardo Habkost <ehabkost@raisama.net>
---
src/lib/platform/COSXKeyState.cpp | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
From 24b77f1f639727cb02cd0ef5b594aec94daeebfc Mon Sep 17 00:00:00 2001
From: Eduardo Habkost <ehabkost@raisama.net>
Date: Tue, 19 Jun 2012 19:46:52 -0300
Subject: [PATCH 1/3] remove NX_NUMPROCS case
1) NX_NUMPROCS isn't supposed to be an event number, but just the number of
events from NX_FIRSTEVENT to NX_LASTEVENT
2) NX_NUMPROCS is > NX_LASTEVENT, so the "default:" branch already
handles it (and shows a warning)
@ehabkost
ehabkost / fix-synergy-modifier-keys.patch
Created June 19, 2012 18:47
Fix for synergy bug #3250
Index: src/lib/platform/COSXKeyState.cpp
===================================================================
--- src/lib/platform/COSXKeyState.cpp (revision 1471)
+++ src/lib/platform/COSXKeyState.cpp (working copy)
@@ -243,6 +243,35 @@
}
KeyModifierMask
+COSXKeyState::mapModifiersFromCarbon(UInt32 mask) const
+{
00000000 47 4e 54 50 2f 31 2e 30 20 4e 4f 54 49 46 59 20 GNTP/1.0 NOTIFY
00000010 4e 4f 4e 45 0d 0a NONE..
00000016 41 70 70 6c 69 63 61 74 69 6f 6e 2d 4e 61 6d 65 Applicat ion-Name
00000026 3a 20 41 64 69 75 6d 0d 0a : Adium. .
0000002F 4e 6f 74 69 66 69 63 61 74 69 6f 6e 2d 4e 61 6d Notifica tion-Nam
0000003F 65 3a 20 43 6f 6e 74 61 63 74 5f 53 74 61 74 75 e: Conta ct_Statu
0000004F 73 4f 6e 6c 69 6e 65 59 65 73 0d 0a 4e 6f 74 69 sOnlineY es..Noti
0000005F 66 69 63 61 74 69 6f 6e 2d 54 69 74 6c 65 3a 20 fication -Title:
0000006F 41 72 74 68 75 72 20 4d 65 6c 6c 6f 0d 0a Arthur M ello..
0000007D 4e 6f 74 69 66 69 63 61 74 69 6f 6e 2d 43 6f 61 Notifica tion-Coa