Skip to content

Instantly share code, notes, and snippets.

/usr/lib/gcc/x86_64-linux-gnu/7/collect2
-plugin
/usr/lib/gcc/x86_64-linux-gnu/7/liblto_plugin.so
-plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/7/lto-wrapper
-plugin-opt=-fresolution=/tmp/cc1vmx7H.res
-plugin-opt=-pass-through=-lgcc_s
-plugin-opt=-pass-through=-lgcc
-plugin-opt=-pass-through=-lc
-plugin-opt=-pass-through=-lgcc_s
-plugin-opt=-pass-through=-lgcc
@o11c
o11c / gdb-init-order.diff
Created May 15, 2017 22:52
Draft at fixing the `tty` bug
diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
index 2a5b128d56..618640cffe 100644
--- a/gdb/cli/cli-cmds.c
+++ b/gdb/cli/cli-cmds.c
@@ -1710,6 +1710,11 @@ void
_initialize_cli_cmds (void)
{
struct cmd_list_element *c;
+ /* Called more than once due to ordering dependencies. */
+ static bool initialized = false;
@o11c
o11c / .gitignore
Last active May 10, 2017 19:01
Portable C89 implementation of signed/unsigned integer dispatch.
/int-str
def give_me_a_switch(args):
sense = False
for a in args:
switch a:
case '+':
sense = True
case '-':
sense = False
case 'a':
a.x = sense
class via_data:
def __init__(self, name=None):
# name can be None for python 3.6
self.name = name
def __get__(self, instance, owner):
if instance is not None:
assert self.name is not None, 'name not specified'
return instance.data[self.name]
return self
def __set_name__(self, owner, name):
#!/bin/sh
# For repositories cloned using `git-remote-bzr` (the official one),
# convert a git commit hash to the bzr hash *and* revno.
set -e
die()
{
printf '%s\n' "$1" >&2
exit 1
}
# This script is sourced from all over the place to fix broken shells.
# It does assume you have at *least* /usr/bin:/bin though.
# Significant care is taken to be sh-compatible; if bash or zsh could be
# required, it could be made simpler or more generic.
has_PATH () {
local tmp=":$PATH:"
[ "${tmp}" != "${tmp#*:$1:}" ]
}
import os
import pycurl
from tqdm import tqdm
downloader = pycurl.Curl()
def sanitize(c):
c.setopt(pycurl.UNRESTRICTED_AUTH, False)
@o11c
o11c / distro-packages.md
Last active April 18, 2017 08:20
How to search for packages in various distros.
import functools
def self_aware(f):
@functools.wraps(f)
def aware_f(*args, aware=False, **kwargs):
rv = f(*args, **kwargs)
if not aware:
# If the function ever might *legitimately* return a callable,
# use a dedicated wrapper type.