Skip to content

Instantly share code, notes, and snippets.

Karen West KarenWest

Block or report user

Report or block KarenWest

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:6b0ce40763561d0b0101
"""
I was given the following puzzle to solve to obtain an interview, and not that I received notice yesterday that I was not selected (could not get the puzzle to perform that well), I was wondering if anyone out there may know how to help me solve this to perform better. It was written in Python, and although I had 2 classes in Python a year or two ago, I'm still new to it compared to the world I used to work in (18 years of embedded C!) Any help or advice so that I may learn from the experience appreciated. Puzzle problem submission for consideration of being selected for an interview there.
Puzzle Challenge Description Given:
Consider a "word" as any sequence of capital letters A-Z (not limited to just "dictionary words"). For any word with at least two different letters, there are other words composed of the same letters but in a different order (for instance, STATIONARILY/ANTIROYALIST, which happen to both be dictionary words; for our purposes "AAIILNORSTTY" is also a "word" composed of the same let
@KarenWest
KarenWest / gist:9373354
Created Mar 5, 2014
number of sections in an object file using bfd data structure on Linux using C
View gist:9373354
My question is in regard to bfd's and how the number of sections work in the following code. The code and the dumps inside the gdb debugger of the bfd structure and it's section structure within it are displayed below. I also included the data structure definitions for the bfd and bfd->sections below. My question is: why when I run this code (executable is called getsections): getsections getsections.o (so pass it the object file for itself) - why is the sections structure blank (all zeroes) and if you look at the bfd->section_count, it has the number 4218960? If you use the Linux command: objdump -h getsections.o, that displays 14 sections (.text, .data, .bss, .rodata, .debug_info, .debug_abbrev, .debug_loc, .debug_aranges, .debug_line, .debug_str, .comment, .comment.SUSE.OPTS, .note-GNU-stack, .eh_frame). I've read what I could find in the BFD documentation on the web, and I'm not sure what I'm doing wrong here since my object file structure is nowhere near what you would see with objdump (14 sections). Any
View ioctl_test.c
#include <stdio.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#define MY_MACIG 'G'
#define READ_IOCTL _IOR(MY_MACIG, 0, int)
//#define WRITE_IOCTL _IOW(MY_MACIG, 1, int)
/* attribute structures */
struct ioctl_test_t {
View ioctl_module.c
/*
* ioctl test module --.
*/
#include <linux/module.h>
#include <linux/kernel.h> /* Needed for KERN_INFO */
#include <linux/errno.h> /* error codes */
#include <linux/proc_fs.h>
#include <asm/uaccess.h>
#include <linux/tty.h>
View saas1hw2question
I just started working on homework 2 in rails as you recommended, even though the course is not currently running. After doing the db migrate and db seed, I started the rails server - that seemed to work. However, when I tried to interact with rotten potatoes via my web browser using at the URL line localhost:3000/movies - I received the following error message - perhaps because the course needs to be running? Not sure. I thought you said last week that I should be able to do these assignments I never got to without the course actually going on - so not sure if it is my error or that the course needs to be running - since I did actually try this a few months ago - but before I had gotten the ruby assignment completely working - so had just tried these first few steps for kicks back then - and it worked then without issue - so unless I'm forgetting something - I do think the course needs to be running to try this - but please let me know if I'm wrong here. Here is the error message from my browser at the
View saas1hw1q7Question
module Enumerable
def initialize(seq1, seq2)
puts "Enumerable initialize"
puts "seq1"
puts seq1
puts "seq2"
puts seq2
@seq1 = seq1
@seq2 = seq2
#return @seq1,@seq2
View gist:5468736
Output from code is in comments at bottom - not sure what I'm doing wrong here, as you will see in
the output.
# -*- coding: utf-8 -*-
=begin
Karen West - Saas1 - homework#1 question #7 - April 7th, 2013
HW 1-7: Iterators, Blocks, Yield
Given two collections (of possibly different lengths), we want to get the Cartesian product of the sequences. A Cartesian product is a sequence that enumerates every possible pair from the two collections, where the pair consists of one element from each collection. For example, the Cartesian product (denoted by ×) of the sequences a = [:a, :b, :c] and b = [4, 5] is:
View newPostAIproj3Q1questions
def computeQValueFromValues(self, state, action):
"""
Compute the Q-value of action in state from the
value function stored in self.values.
"""
"*** YOUR CODE HERE ***"
#for this state and action, get list of probabilities for
#the legal transitions to new states for this state
#if "North" or "South" is action --returns (northState,1-self.noise),
#followed by (westState, self.noise/2.0) and (eastState, self.noise/2)
View aiproj3q1question
def computeQValueFromValues(self, state, action):
"""
Compute the Q-value of action in state from the
value function stored in self.values.
"""
"*** YOUR CODE HERE ***"
#for this state and action, get list of probabilities for
#the legal transitions to new states for this state
#if "North" or "South" is action --returns (northState,1-self.noise),
#followed by (westState, self.noise/2.0) and (eastState, self.noise/2)
View saas1hw1q6new_question
# -*- coding: utf-8 -*-
=begin
Karen West - April 7th, 2013 - homework#1 question#6
HW 1-6: Advanced OOP, Metaprogramming, Open Classes and Duck Typing
Part A — Currency conversion (ELLS 3.11): Extend the currency-conversion
example from lecture so that code such as the following will work:
5.dollars.in(:euros)
10.euros.in(:rupees)
You can’t perform that action at this time.