Skip to content

Instantly share code, notes, and snippets.

View drj11's full-sized avatar

David Jones drj11

View GitHub Profile
@drj11
drj11 / gist:e85ca2d7503f28ebfde8
Created September 26, 2014 14:17
Copy of CVE-2014-6271.diff
Description: fix incorrect function parsing
Author: Chet Ramey <chet.ramey@case.edu>
Index: bash-4.2/bash/builtins/common.h
===================================================================
--- bash-4.2.orig/bash/builtins/common.h 2010-05-30 18:31:51.000000000 -0400
+++ bash-4.2/bash/builtins/common.h 2014-09-22 15:30:40.372413446 -0400
@@ -35,6 +35,8 @@
#define SEVAL_NOLONGJMP 0x040
@drj11
drj11 / gist:239e04c686f0886253fa
Created September 26, 2014 14:38
Copy of CVE-2014-7169.diff
Description: fix incomplete CVE-2014-6271 update
Author: Chet Ramey <chet.ramey@case.edu>
Origin: upstream, http://www.openwall.com/lists/oss-security/2014/09/25/10
Index: bash-4.2/bash/parse.y
===================================================================
--- bash-4.2.orig/bash/parse.y 2014-09-25 02:09:45.791186206 -0400
+++ bash-4.2/bash/parse.y 2014-09-25 02:09:45.791186206 -0400
@@ -2848,6 +2848,8 @@
FREE (word_desc_to_read);
Jan 6 08:32:00 bay anacron[10676]: Job `cron.daily' terminated
Jan 6 08:32:00 bay anacron[10676]: Normal exit (1 job run)
Jan 6 08:32:25 bay kernel: [ 9858.677082] current rate 48000 is different from the runtime rate 44100
Jan 6 08:32:25 bay kernel: [ 9858.677547] current rate 48000 is different from the runtime rate 44100
Jan 6 08:32:56 bay kernel: [ 9888.788891] current rate 48000 is different from the runtime rate 44100
Jan 6 08:32:56 bay kernel: [ 9888.789373] current rate 48000 is different from the runtime rate 44100
Jan 6 08:34:53 bay kernel: [10006.211990] current rate 48000 is different from the runtime rate 44100
Jan 6 08:34:53 bay kernel: [10006.212406] current rate 48000 is different from the runtime rate 44100
Jan 6 08:35:31 bay kernel: [10044.026686] current rate 48000 is different from the runtime rate 44100
Jan 6 08:35:31 bay kernel: [10044.027181] current rate 48000 is different from the runtime rate 44100
@drj11
drj11 / gist:2577a9a0262f1a9bc016
Created February 3, 2015 10:40
Wrong code for converting number to Excel row ref
import string
def base_(x, acc):
if x == 0:
return acc
string.uppercase
q, r = divmod(x, 26)
l = string.uppercase[r]
return base_(q, l + acc)
@drj11
drj11 / sizeof.c
Created October 14, 2015 08:23
Print sizes (in bits) of int, long, and pointer types in C
#include <assert.h>
#include <limits.h>
#include <stdio.h>
int main(void) {
size_t i = sizeof(int);
size_t l = sizeof(long);
size_t p = sizeof(void *);
assert(i <= INT_MAX/CHAR_BIT);
@drj11
drj11 / grub.cfg
Created October 29, 2015 10:13
grub 2015-10-29
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#
### BEGIN /etc/grub.d/00_header ###
if [ -s $prefix/grubenv ]; then
set have_grubenv=true
@drj11
drj11 / 2015-12-08-minutes.md
Last active December 8, 2015 16:54
2015-12-08 Sheffield Software Carpentry

Minutes

We will get TUOS to be an Affiliate supporter of Software Carpentry (http://software-carpentry.org/scf/membership.html). @walkingrandomly to act.

We will hold a Data Carpentry course first, then plan 2 more (Software Carpentry) courses.

1st course to be held in March ish. Check Semester / PhD program dates. @annakystalli to find out the PhD program dates.

@drj11
drj11 / gist:a166dc235259b1a26ca0
Last active December 21, 2015 15:19
Clegg 2015-12-21
[I asked Nick Clegg to support EDM 660 http://www.parliament.uk/edm/2015-16/660]
Clegg's reply:
I have not been in the practice of signing Early Day Motions for
many years now; in fact, I was precluded from doing so whilst I
was in Government. Although Early Day Motions have their place,
I have found from experience that they are not always the most
effective tool to bring about the change that is sought. I
personally think it’s far more effective to contact Ministers
a = ['hello']
b = a
def f(x):
pass
# anything you like here
f(a)
print(a is b)
@drj11
drj11 / gist:f166cae63e846ba6370d
Created January 28, 2016 11:08
close over unassigned variable
def box(x):
if x:
a = x
def f():
return a
return f
gives1 = box(1)
print(gives1())
explodes = box(0)