text:
# Your Brain at Work, David Rock

### Scene 1

- Epidemic of overwhelm: having too much to do.
- Making decisions = prefrontal cortex.
  - Without this, you wouldn't be able to set any type of goal, control impulses, solve problems, think creatively.
  - This is the seat of all conscious interactions with the world. This makes you think things through, instead of being on "autopilot" as you go about your life.
  - It can only process so many things.
- The metaphor is that it's a stage, and to understand a new idea, you have to put the ideas for a specific amount of time to see how they'd connect to audience members. To make decisions, you hold actors onstage and compare them to one another, making judgments.
- Functions:
  - Understanding
  - Deciding
  - Recalling
  - Memorizing
  - Inhibiting (keeping actors off).
- Mental abilities consume energy too, there are some questions you can't answer while walking up a hill.
- Basal ganglia
  - Older part of the brain, highly energy efficient, and it functions beneath conscious awareness, so if you're a good driver, you can drive + think about something else.
  - Making a difficult decision can be made easier by drinking a glucose drink.
- When you're tired or hungry, it's so easy to get distracted.
- Since you have an allocated number of brain functions per day, you should allocate it well in the same way that you allocate your money. Each time you use your mental stage, allocate it to something important.

#### Prioritize Prioritizing

- Picturing solutions (something you haven't seen yet) take a lot more energy than picturing problems (because they've happened already). This is why setting goals seems so hard. People base their feelings on the future according to how they feel today, instead of assessing their mental state at the future date.
- This is also why prioritizing is hard, it involves imagining and then moving around concepts of which you have no direct experience.

- That's why you make the prioritization.
- Change tasks not according to topic, but according to type of cognitive load required. It's like lift, then cardio, then stretching.
- Need to learn to say no to tasks that re not among your priorities.
- Ex:
  - Audio recorder to remember things.
  - Recognize what's the hardest thing to do, and do that first.

- Conscious thinking involves deeply complex biological interactions in the brain among billions of neurons.
- The most important mental processes, such as prioritizing, often take the most effort.
- Visual stuff: easier to remember.
- Schedule blocks of time for different modes of thinking.

#### Scene 2

- You have about 4 words to remember, but it has to be in a pattern that you understand. "hello world" is easier to remember than "`cqwce adszc`" even though they have the same number of letters in them.
- Relational complexity: the fewer variables you have to hold in your mind, the more effective you are at making decisions.
- The brain doesn't like it when it has to think of multiple things at once.
- Simplifying complicated ideas into core elements. "Jaws in space".
- It's actually easier to memorize things when you chunk them together (5 pairs rather than 10 numbers).

#### Scene 3

- It's easy to drive and chat with a friend on a well-traveled route, not so much if it's a new destination. Same with changing your keyboard layout.
- ***Understanding:*** creating maps in the prefrontal cortex that represent new, incoming information, and connecting these maps to existing maps in the rest of the brain.
- ***Making a decision:*** activating a series of maps in the prefrontal cortex and making a choice between those maps.
- ***Recalling:*** involves searching through the maps and bringing just the right ones into the prefrontal cortex.
- ***Memorizing:*** holding maps in attention long enough to embed them in long-term memory.
- ***Inhibiting.*** Trying not to activate certain maps.
- Constant emailing and text-messaging reduces mental capability by ten points per IQ test.
- Solution:
  - Automate as much as possible. Keyboard keystrokes.
  - Get information onstage in the best possible order.
  - Mix up your attention.
- Basal ganglia: loves patterns. Only three repetitions of a routine is enough to begin long-term potentiation (hardwiring). This is why if you drive it long enough, you free the stage up for new functions.
- Replying to the email with a smiley face. :)
- Constantly decide how long you will split your attention, then go back to focusing on one ting.

- You can only multitask easily if you are executing embedded routines.
- Catch yourself trying to do two things at once and slow down instead.
- Embed repetitive tasks where you can.

#### Scene 4

- 11 minutes on a project before being distracted (October 2005). People switch activities every 3 minutes.
- Bigger computer screen = clear winner in becoming more efficient.
- Switch off all communication devices during any thinking work.
- Internal distractions: randomly daydreaming. Ambient neural activity.
- We are the descendants of people who paid a lot of attention when there was a rustle in the bushes.
- Why people do not prefer change: because big changes have too much novelty. If the error-detection circuitry fires too often, it brings on a state of anxiety or fear.
- Ventrolateral prefrontal cortex (VLPFC) is in charge of inhibition.
- The braking system is the most fragile, temperamental, and energy-hungry region of the brain. So it works only every now and then.
- Your brain will think of things, but you always have a veto.

- When we get distracted, it's often a result of thinking about ourselves, which activates the default network in the brain.
- Being "always on" (connected to others via technology) can drop your IQ significantly, as much as losing a night's sleep.
 So you can improve your mental braking system that way.

#### Scene 5

- A certain level of arousal is required for the prefrontal cortex to work at its best.
- Eustress: positive stress. You need that to get out of bed in the morning.
 If you go to the forest, you will be calmer.
- Increase adrenaline to bring urgency to a task. ***Visualizing an activity generates a similar metabolic response to actually doing it.***
- To get interested: try out something new. Change perspectives, chat with other people. He could speak out loud about his project, listen to some jokes, call a friend he like to have a laugh with.
- Positive event: food, sex, money, positive social interactions.
- He could have focused on the possible rewards of his doing a great job on this proposal, the money he could win, and the future rewards that would come his way.
- When you don't feel that things are urgent, you don't act on it.
- Estrogen promotes the stress response, and so women are better at getting things done.
- Over-arousal:

#### Scene 6

- Impasse: you want to make a connection but you can't.
- Insight experience: lack of logical progression, instead, you ave a sudden knowing regarding the answer.
- A-duh moment: when someone is told an answer to a problem they've already solved, they read that answer faster.
- A-ha moment: solving a problem with insight yourself.
- Taking a walk: clearing your mind so you have no carry over memory from thinking. When you take a break, the active ways of thinking diminish. This is why people can see answers to problems that you can't. They aren't locked into your way of thinking yet.
- Right anterior temporal lobe: allows you to pull together distantly related information.
- Increasing happiness increases the likelihood of insight, while increasing anxiety decreases it.  This is why companies such as Google create work environments that allow for fun and play.
- People who are more insightful have more awareness of their internal experience. They can observe their own thinking, and thus can change how they think.
- ARIA: awareness, reflection, insight, control.
  - Awareness: focus lightly. Put the problem on the stage, but ensure it takes up as little space as possible. Don't focus too hard.
  - Reflection: focus on your thinking process, rather than the content of thoughts. If none of your strategies are working, you can allow new strategies to emerge into awareness. Make sure your impasse sees things from a high level.
  - Insight: burst of gamma band brain waves. ***People in deep meditation have a lot of gamma waves, and people with learning difficulties have fewer ones. Someone who is unconscious has almost none.***
  - Action: The high of figuring things out.

- Hitting a mental wall:
  - Do something fun, reduce anxiety.
  - Take a break and do something light/interesting to see if an answer emerges.
  - Quiet your mind and see what is there in the subtle connections.
  - Focus on the connections between information rather than drilling down into a problem.

#### Intermission

- Self awareness: looking at yourself from another person's perspective.
- Meta-perspective: like interacting with a different person.
- Technical term: mindfulness. Ex: "I should probably stop emailing."
- Mindful Awareness Attention Scale.
  - High scores have high physical/mental health, as well as quality of their relationships.
  - Recurrence of depression could be decreased by 75% with mindfulness training.
  - Default network: when you're not thinking about anything. Planning, daydreaming. This is involved in narratives.
  - Direct experience: you are not thinking intently about the past or future, rather you are experiencing information coming into your senses in real time.
- When you focus your attention on incoming data, it reduces activation of the narrative circuitry.
- When you want to focus on your current experience, you'll find out that it's actually hard to do. Your attention keeps on wanting to drift away.
- When you get better at meditation, you get better at noticing the difference between directly experiencing something and the interpretation added by the brain.
- People high on mindfulness are more aware of their unconscious processes.

### Act 2

#### Scene 7: Derailed by Drama

- Limbic system: tracks your emotional relationship to thoughts, objects, people, and events. It determines how you feel about the world, moment to moment.
- It unconsciously drives your behavior.
- Everything you do in life is based on your brain's determination to minimize danger and maximize reward.
- Primary threat: anything that can endanger your life. Even with words that sound pleasant or unpleasant.
- Good for us evolutionarily to be hyper vigilant. A stimulated amygdala = emotions such as anxiety.
- Limbic system fires more often when it perceives a danger compared to when it senses a reward.
- Lust (strongest toward emotion), is unlikely to make you run, but fear can do so in an instant.
- This is why positive emotional spirals are less common than downward ones, because humans walk towards, but run away.
- Things that trigger limbic system arousal: hot spots/patterns of experience stored in your limbic system and tagged as dangerous.
- Increased adrenaline when you experience fear might make you feel focused and more confident in your decisions, when your ability to make the best decisions has actually been reduced.
- When your limbic system is aroused, it reduces the resources available for prefrontal cortex functions. With arousal, it might take you longer to recall names.
- Better to have smiling faces rather than frowning ones. Your cognitive functions get worse when you have strong emotions.
- Problems with limbic system arousal:
  - When there are not enough resources for conscious processing, the brain becomes more "automatic".
  - Hard for you to think, director is gone.
  - More likely to respond negatively to situations. Because you are superconscious of the dangerous side of life, you look out for even more danger when aroused by threats.
  - Higher chance to make links where there may not be any.
- When you experience over-arousal over a long period of time, your level of markers (cortisol, adrenaline) become high.

  - Expressive suppression: holding your feelings down.
  - Cognitive change: phrasing it/labeling it differently. Reappraise your interpretation of an event.
- Suppressing the expression of an emotion: their memory of events is impaired, as if they are consciously focusing their attention elsewhere.
- When the participants labeled the emotional faces using words, less activity occurred in the amygdala.
- It's almost always better to express your feelings (study) if you want to decrease emotional arousal. Describe an emotion in just a word or two, and it helps reduce the emotion. Describe your emotion to reduce it.
- People who are more mindful are better re: the brain being a part of the inhibition process.
- Successful people can harness deep stress and turn it into eustress. Naming!

- Once an emotion kicks in, trying to suppress it doesn't work or makes it worse.
- Suppressing an emotion makes other people feel uncomfortable.
- Label the emotion. Symbolic, not a long dialogue, for it to reduce arousal.
- Practice noticing emotions as they arise, to get better at sensing their presence earlier.

### Scene 8

- The brain is a prediction machine. Massive resources are devoted to predicting what will happen each moment.
- Prediction is the primary function of your neocortex, and the foundation of intelligence.
- You hear + predict what you should hear, you see + predict what you should see.
- When the craving for certainty is met, there is a sensation of reward.
- Things like Sudoku and crossword are enjoyable because they give you a little rush from creating more certainty in the world, in a safe way.
- Industries devoted to resolving uncertainties: palm readers, prediction engines, forecasters.
- Uncertainty: you'll feel different when you know what a person looks like.
- Emotional regulation techniques to manage uncertainty.
- Stress from recognizing that her level of control over her work has decreased.
- The degree of control that organisms can exert over something that creates stress determines whether that stressor alters the organism's functioning.
- ***The perception of control over a stressor alters a stressor's impact.***
- Work-life balance as the main reason people start their own small businesses. Though business owners make more hours, they are able to make more of their choices.
- Finding that you have choices in a situation reduces the threats from both autonomy and uncertainty. Emily could reduce here stress over a proposal's being approved by remembering she could choose to reschedule here meeting.
- Even the smallest perception of choice can impact limbic system arousal.
- Finding a way to make a choice shifts yourself from an "away" response to a "toward" response.
- ***Decide to be responsible for your mental state rather than feel grumpy.***
- Responsibility: an ability to respond. Generate a toward response by making an active choice.
- People have to control your interpretation of the meaning of the situation, and that's what reappraisal is all about.
- Conscious control over the limbic system is possible, not by suppressing a feeling, but rather by changing the interpretation that creates the feeling in the first place.
- Reappraisals:
  - Recognize that the threatening event is no longer a threat. When you see the people in a queue, you'll realize that you aren't going to miss the flight.
  - Normalizing: when you don't have complete mental maps for things yet, you use your stage a lot. ***This is why doing change is so hard: doing things differently can bring about a negative spiral that can feel overwhelming.*** Just tell yourself that it's normal to feel overwhelmed in the first few weeks of a new job.
  - Reordering information: you can put on a positive spin on things by reconfiguring what's going on.
  - Repositioning: taking another person's perspective and changing the context through which you view a situation.
  - Someone who could not regulate his emotions well would last about an hour in most jobs. You can be calm in any situation, as long as you can reappraise.
  - Almost always, you can reposition things with appraisal.
- Is success at work based on the ability to make up false interpretations of the world instead of dealing with reality?
- Apparently, happy people perform better at many type of work. So, basically, yes?
- ***All the brain can know, it knows from inside itself.*** - Walter Freeman. All the interpretations of the world are just that, interpretations your brain has made, and ultimately just yours--then having a choice about which interpretation you might use at any moment makes more sense.
- Problem with reappraisal: expensive. You have to generate alternate modes of thinking and hold those things in your mind. Then you choose the alternative interpretation that makes the most sense, and keep focused on that.
- ***This is why it's easier to reappraise with someone else (a mentor, coach, career counselor).***
- Humor = reappraisal. It's much easier to see options when you laugh at an otherwise tough situation.
- ***It's not you, it's your brain. You can't think of a complex work situation and walk around the house at the same time.  You can't learn to do anything new and complex without your limbic system firing up from uncertainty.  You can't go into a meeting at four o'clock and expect yourself and everyone else to come up with brilliant ideas, it's not you or them, it's your brain.***

- Certainty is a primary reward or threat for the brain.
- Autonomy, the feeling of control, is another primary reward or threat for the brain.
- People who reappraise more appear to live better lives.

- Find ways to create choice and a perception of autonomy whenever you can.
- Practice reappraisal early when you feel a strong emotion coming on. You can reappraise by reinterpreting an event, reordering your values, or normalizing an event, or repositioning your perspective.
- When you're at the point of managing internal stressors, just think, "That's just my brain."

### Scene 9: When Expectations Get Out of Control

- The excitement about potentially winning creates arousal in your limbic system.
- The expectation of reward has an impact on your brain.
- Your brain orients toward events, people, and information that connects to what you have valued positively.
- Expectations alter perception. People see what they expect to see, and not see what they are not expecting.
- The brain is built to avoid threat, and so people tend to work hard to reinterpret events to meet their expectations.
- Positive expectations produce a reduction in perceived pain that rivals the effects of an analgesic dose of morphine.
- Underpromising: unexpected rewards release more dopamine than expected ones. What's bad is expecting a reward and not getting it.
- When dopamine levels are too low, the number of connections per second in the brain fails.
- You need a good level of dopamine to hold an idea in your prefrontal cortex. Obviously you need to be interested in something to learn it.
- The best way to manage your expectations is to start to pay attention to them.
- Unmet expectations: bad.
- Pay additional attention to positive expectations you know will be met for sure.
- Great athletes don't get overexcited about winning, as this ruins their concentration.

- Expectations are the experience of the brain paying attention to a possible reward or threat.
- It's common to fit incoming data into expectations and ignore data that don't fit.
- Exceeded expectations generate a strong increase in dopamine, and a strong reward response. Unmet expectations generate a large drop in dopamine level, and a strong threat response.
- A general feeling of expecting good things generates a healthy level of dopamine, and may be the neurochemical marker of feeling happy.
- Practice setting expectations a little lower.
- To stay in a positive state of mind, find ways to keep coming out ahead of your expectations over and again, even in small ways.
- ***When a positive expectation is not being met, practice reappraising the situation by remember it's your brain doing something odd with dopamine.***

## Act III: Collaborate with Others

### Chapter 10:

- The social world is deeply important to our moment-to-moment existence. A lot of background processes involve thinking about other people and yourself.
- Common mode of human interaction: distrusting others. Every little thing in this state escalates.
- As a human, you get your resources not from the wild, but from other people.
- Her conference call went wrong because people made mistakes about the mental state of the others on the call. Without a face and body language visible, everyone misread his intent.
- Mirror neurons: work only if the person they're watching has an intent.
- People with autism are considered "mind blind." They don't accurately decipher what other people are thinking, feeling, or intending, which results in social blunders.
- On a conference call, without faces to see, the group couldn't read one another's emotions.
- If people don't have social cues to pay attention to, they can't connect with other people's emotional state.
- An abundance of social cues makes people connect more richly, perhaps in challenging ways at times. The strongest emotion in a team can ripple out and drive everyone to resonate with the same emotion, without anyone consciously knowing this is happening. The strong emotion gets attention, and what people pay attention to will activate their mirror neurons.
- If you want to collaborate well with others, you have to understand what kind of state others are in.
- People naturally tend to form safe tribes with close colleagues, because collaborating with people you don't know well is a threat for the brain. The automatic response to strangers is "don't trust them". Tendency for people to be classified as foe until proven, otherwise.
- ***When you interconnect your thoughts, emotions, and goals with other people, you release oxytocin.*** Just a spray of oxytocin increased their level of trust. This is why facilitators and trainers insist on icebreakers at the start of workshops, and why establish rapport is the first step in consulting/customer service/sales training.
- The one thing that makes people happy is the quality and quantity of their social connections.
- 30 point difference in blood pressure between those who experienced loneliness and those with healthy social connections. Loneliness could increase the risk of death from stroke and heart disease. Having friends around you reduces a deeply ingrained biological threat response.
- Having people you trust around can help you bring about insights, by broadening thinking and helping you to see your own thinking. Having friends helps you change your brain, because you get to speak out loud more often. When you speak to someone about an idea, many more parts of your brain are activated in just thinking about the idea, including memory regions, language regions, and motor centers.
- Thinking someone is a foe can even make you less smart, because you constantly get distracted by how they would think, instead of dealing with the business at hand.
- A handshake, swapping names, and discussing something in common can increase feelings of closeness by causing oxytocin to be released.
- Companies that encourage water-cooler conversations exhibit greater productivity. Increasing the quality and quantity of social connections is likely to improve productivity.

- Anytime you meet someone new, make an effort to connect on a human level as early as possible to reduce the threat response.
- Become friends with people you work with by sharing personal experiences.

### Scene 11: When Everything Seems Unfair

- Once you prime your prefrontal cortex to look out for fairness issues, they start to appear everywhere.
- Ultimatum gain: people would sort of rather prefer a fair situation rather than financial reward?
- Anterior insula = associated with disgust, and it gets activated when you feel something is unfair.
- Fairness = the need to trade efficiently?
- Unfairness packs a hefty punch, so it's easy to get upset by small injustices when you're tired, or when your limbic system already has a strong base load of arousal.
- **Because of poor emotion-regulation capacity, teens feel the threats and rewards arising from fairness very intensely.**
- Fairness is hedonically rewarding. The feeling you get from a sense of fairness is one of connecting safely with others, so it's linked to relatedness.
- Giving to others activates a greater reward response than receiving gifts of similar value.
- Fairness/expectations helps explain the delight of the kindness of strangers, as well as the intense emotions of betrayal from people close to you.
- Men don't experience empathy with someone who is in pain who has been unfair, whereas women do.
- Be open and transparent about your dealings with people, remembering that unfairness is easy to trigger.
- Find ways to sense increasing fairness around you, perhaps by volunteering or donating money or resources regularly.

### The Battle for Status

- You don't have to be best friends with people to do good work.
- Status is another major driver of social behavior. Status is another primary reward or threat.
- **Reward circuits were activated when people saw others as worse off than they.**
- Status explains why people love to win arguments, even pointless ones.
- This sort of explains why people play video games with no benefits except for points to raise their status compared to that of others.
- Being left out, being classes as "less than" others, is a universally painful experience.
- Exclusion and rejection is physiologically painful. Five different pain points in the brain when social pain is experienced.
- The reaction is to a status issue could be attacking the status back.
- People don't like to be wrong because being wrong drops your status, in a way that feels dangerous and unnerving.
- Higher-status monkeys have reduced day-to-day cortisol levels, are healthier, and live longer. Status is a significant determinant of human longevity, even controlling for education and income.
- We're wired to feel rewarded by any incremental increase in status.
- Recurring themes/narratives: ordinary people doing extraordinary things, or extraordinary people doing ordinary things.
- The feeling of high status helps you process more information with less effort.
- With the reduced threat response from the increase in positive emotions, you have plenty of resources for the prefrontal cortex to help you think on multiple levels.
- ***Help someone else feel that her status has gone up.*** Giving positive feedback, pointing out what they do well gives others a sense of increasing status, especially when done publicly.
- ***Playing against yourself.*** This makes you feel good about yourself. You can harness the power of beating the other guy without hurting anyone in the process.

#### SCARF

- Life's most intense emotional reactions involve a confluence of the elements of SCARF.
  - Status
  - Certainty
  - Autonomy
  - Relatedness
  - Fairness
- Social pain comes back when you think about it again, whereas physical pain doesn't.
- You can also increase other people's feelings when you compliment them on SCARF things.
  - Telling what's good about you (raising status).
  - Being clear with their expectation of you (increasing certainty).
  - Letting you make decisions (increasing autonomy).
  - Connects with you on a human level (increasing relatedness).
  - Treats you fairly.

- Status is a driver of behavior at work and across life experiences.
- A sense of status, going up, even in a small way, activates your reward circuits.
- People pay a lot of attention to protecting/building their status, more to this than any other element of SCARF.
- When everyone is trying to be higher status than others, there is a decrease in relatedness.
- Playing against yourself increases your status without threatening others.

- Watch out for people's status being threatened.
- Reduce status threats in others by lowering your status through sharing your own humanity or mistakes.
- Find ways to play against yourself, and pay a lot of attention to any incremental improvements.

## Act IV

### Scene 13: When Other People Lost the Plot

- The default approach to helping people: trying to understand the source of the problem, and then making suggestions.
- ***Feedback creates a strong threat for people in most situations.***
- "Let me tell you what others have been saying about you": a fast way to make someone deeply anxious.
- As "constructive" as you try to make it, even a subtle status threat is picked up unconsciously by our deeply social brain, no matter how nicely it's couched.
- Unless you take care to label your emotions when they are at a high level, and not dwell on them, bringing problems to mind will increase limbic arousal, making it harder to solve them.
- What's key is for you to solve the right problem, which means the most useful problem, not the most interesting one.
- It's easier to focus on problems because the problem is in the past. Since electrical impulses are more likely to travel along existing paths, that requires less energy than travelling along paths that don't yet exist.

#### Finding the Solution

- To solve the problem of getting to the airport, you can focus on "How can I find a taxi?" You can then figure out where it's easiest to find a taxi.
- You focus on the desired outcome, rather than on the past. Attention went to your goal, rather than to your problem.
- When you focus on an outcome, you prime the brain to perceive information relative to that outcome, rather than to notice information about the problem (not getting to the airport).
- You can't be looking for solutions and problems at the same time. And if it's a solution that's needed, it's more useful to prime your brain to notice information relevant to the solution itself.
- ***When you look for solutions, you scan your environment widely for cues, which activates more of the right hemisphere of the brain, rather than drilling down into information that activates the left hemisphere. Activating the right hemisphere is helpful for having insights, which is how complex problems are often solved.***
- ***When you focus on problems, you are more likely to activate the emotions connected with those problems, which will create greater noise in the brain. This inhibits insight. Whereas focusing on solutions generates a toward state, because you desire something. You are seeking, not avoiding. This increases dopamine levels, which is useful for insight. And if you're expecting you might find a solution, these positive expectations help release even more dopamine.***
- Focusing on solutions is not the natural tendency of the brain. Solutions are generally untested, and thus uncertain. It takes effort to dampen down the threat created that comes with uncertainty.
- While it's logical to head straight to solutions, what often happens is that people often end up providing a set of solutions to the other person.
  - Solutions might impact someone's relative status.
  - Solutions can threaten autonomy (not my choice). Try to make the other person think of the solution to the problem.
  - The irony: the harder leaders think about other people's problems, the more others feel threatened and discount the suggestions made.
- Giving other people clues about what people should think about, and giving them clues about what they shouldn't think about.
- Dr. Stellan Ohlsson: ***When people hit an impasse, telling what not to think helps only 5% of the time, and giving people clues about what they should think helps only 8% of the time.***
- To solve problems:
  - SCARF model: encourage, increase someone's sense of certainty by clarifying your objectives, increasing autonomy by ensuring that he is making the decisions.
  - Simplify a problem into as few words as possible.
  - You want people to be in the correct state of mind, and to facilitate that state of mind.
- Questions like:
  - "If you stop and think more deeply here, do you think you know what you need to solve this?"
  - "What quiet hunches do you have about a solution deeper inside?"
  - "How close to a solution are you?"
  - "What pathway to a solution would be best to follow here?"
  - Help the other person notice the subtle, high-level connections in his own thinking, which will make insight more likely. While you can't control insight, you can influence it more than other people realize.
  - ***With these questions, instead of your looking for a gap in the form of the source of another person's problem, the other person is finding a gap in their own thinking process. It's not you searching for problems, it's him searching for gaps in his thinking process.***
- Grading students not on how they wrote their paper, but how they critiqued their own work.
- ***When you leave a gap between writing and editing, you've forgotten it's you who wrote the words.***
- People are capable of giving themselves feedback, especially if their status isn't threatened. Get people to activate their director, using status as the reward to do so.

- While the easy answer re: trying to change other people's thinking might be to give feedback, real change happens when people see things they have not seen before.
- Giving feedback often creates an intense threat response that doesn't help people improve performance.
- Help people think about their own thinking by focusing them on their own subtle, internal thoughts, without getting into too much detail.
- Find ways to make it valuable for people to give themselves feedback; reward them for activating their director.

### Scene 14: The Culture That Needs to Transform

- Carrot and stick approaches don't work well with adults.
- Attention/focusing them in the right way.

- Putting a blindfold on someone creates change in the auditory cortex in a matter of minutes.
- Learning a new language is easy, but you have to stop paying attention to your current language. That's why moving to France is the fastest way of learning to speak French, your attention is forced there all day long.
- It's not hard to change your brain, you just need to put in enough effort to focus your attention in new ways.
- ***All you need to do to change a culture, whether at home or at work, is focus other people's attention in new ways long enough.***
- Sensing someone is trying to change you often creates an automatic threat response, linked to uncertainty, status, and autonomy. Churchill: "I love to learn, but I hate to be taught."
- Steps:
  - Create a safe environment so threat response is minimized.
  - Focus their attention in just the right ways to create just the right new connections.
  - You have to get people coming back to pay attention to their new circuits over and again.
- Increase status: Offer a reward that treated them as being older or more competent, or publicly recognizing them.
- Increase certainty: Set expectations on what would happen during her proposed family conference, reducing fear of the unknown.
- Increase autonomy: Give the kids the chance to make more of their own decisions.
- Increase relatedness: Increase opportunities to network with their peers, by allowing them to attend more conferences or networking groups.
- Creating a sense of safety is the first step to transforming a culture.
- ***Keeping attention: telling a story.*** A good story creates complex maps in the brain as people hold different characters and events on the stage. Stories have some "point", some specific idea at their core, which the storyteller wants others to understand.
- ***Asking the right question:*** "What is one thing you have done that has made a customer delighted in the past? What did you do differently that made the customer so happy? What would it take for you to do this more often?"
  - Asking questions help people arrive at their own insights. When you ask people to answer questions like this, there is an implicit respect inherent to the question. Status reward, rather than a "What's wrong with us?".
  - Implicit respect inherent in the question, the suggestion that you know people have good answers.
  - Small groups to minimize status threats.
  - Once the general threat level is reduced in a group, focus people's attention on exactly the direction you want them to go in.
  - Status reward, rather than the "what's wrong with us?" question that might threaten status.
- ***Establishing goals.***
  - When you set up a goal, you set up the possibility of a positive spiral.
  - You're more likely to perceive information relating to it, which makes you feel positive, because you feel that the goal is going to happen, which makes you look out for it more.
  - Giving people small achievements to notice. The right goal can increase a sense of certainty by providing more clarity on objectives, and it can increase a sense of autonomy if people have a say in how they achieve the goal.
  - If you're planning on setting goals for other people, perhaps instead create a framework for them to set goals for themselves.
  - ***Attention density: When you make a promise to another person to do something, it comes into your mind more often, because of a status threat if you don't do it.***
  - You can get other people to collaborate if you want to do a task. Remember that the brain is eminently social, so if you can get a change you desire linked to the social world, you're on the right track.
  - To change a culture, start by paying attention to everyone's attention, and work out how to focus their attention in new ways.
  - Learning how to change a culture means learning how to facilitate self-directed neuroplasticity.

#### Leading Change

- Unfortunately, many of the people who make it to leadership positions have a highly developed intellect but are poor on the social side of things.
- The brain network involved in holding information, planning, working memory and cognitive problem solving tends to be on the lateral, or outer, portions of the brain.
- The regions more involved in the midline/middle areas are related to self-awareness, social cognition, and empathy.
- These two networks are inversely correlated: when one is active, the other tends to be deactivated. So there is something inversely correlated about social and nonsocial abilities.
- If you spend a lot of time in cognitive tasks, your ability to have empathy with people reduces simply because that circuitry doesn't get used much.

- Focused attention changes the brain.
- Attention goes all too easily to the threat.
- Creating long-term change requires paying regular attention to deepen new circuits, especially when they are new.

### Encore

- Microscopic changes in brain functioning can sometimes create massive change in people's lives. By reducing the activation of one brain region and increasing another, this quickly grows into a totally different behavioral response to the same stimuli.
- "Know yourself" might been "know the functioning of your own brain."
- Much of your mental activity is automatic, driven by forces out of your control, often in reaction to predefined goals, such as maintaining status or certainty.
- Act 1:
  - Being able to plan, organize, prioritize, create, or do just about anything except repetitive mental tasks requires a small, fragile, and energy-hungry brain region using the prefrontal cortex.
  - The brain is so easily distracted.
  - The importance of being able to step outside your experience and observe your mental functions, which comes from an ability to focus attention n the moment, openly.
- Act 2:
  - The brain is built to minimize danger and maximize reward.
  - "Toward" states tend to be more productive for doing good work. "Away" is intense.
  - Thinking capacity can be reduced by remembering past threatening situations, by uncertainty, and by a feeling of a lack of autonomy.
  - Labeling/reappraisal, and expectations.
- Act 3:
  - Social world from the brain's perspective.
  - SCARF generates either a "toward" or "away" response with the same intensity and using the same circuitry as a reward or danger for one's life.
  - We want to minimize social dangers and maximize social rewards.
- Act 4:
  - Hard to change other people, because of our natural tendency to focus on problems and make suggestions.
  - Changing a culture = changing their own brain.
- The importance of the director:
  - Repetition is key. As your director becomes stronger, it gets easier to decide what to put on your stage and what to keep off, when to pay close attention to something, and when to step back and allow loose connections to occur instead.

license: Unlicense

repository: daryllxd/lifelong-learning

gha_language: Elixir

gha_license_id: Unlicense

repo_name: daryllxd/lifelong-learning


text:
# Grandiniella calotricha (P. Karst.) Burds., 1977 SPECIES

#### Status
SYNONYM

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Taxon 26: 329 (1977)

#### Original name
Corticium calotrichum P. Karst., 1888

### Remarks
null

repository: mdoering/backbone

path: /life/Fungi/Basidiomycota/Agaricomycetes/Polyporales/Phanerochaetaceae/Phanerochaete/Phanerochaete calotricha/ Syn. Grandiniella calotricha/README.md

branch_name: refs/heads/master

extension: md

license_type: permissive

repo_name: mdoering/backbone


text:
# Frontend Mentor - Fylo data storage component

## Welcome! 👋

Thanks for checking out this front-end coding challenge.

[Frontend Mentor](https://www.frontendmentor.io) challenges help you improve your coding skills by building realistic projects.

### Screenshot

![Screenshot](screenshot.png?raw=true "Screenshot")

### Links

- Solution URL: [Repo](https://github.com/zulamirsofian/fylo-data-storage-component)
- Live Site URL: [Zulamir's Github](https://zulamirsofian.github.io/frontendmentor/fylo-data-storage-component)

### Built with

- Flex
- Flex for @media
- Flex in a flex
- vw, vh and %

### What I learned

- CSS measurement units, relative and fixed units
- Setting width and height for child containers and also parent divs / containers
- @media query
- :hover css
- background: linear-gradient
- calc in css for responsive web design

## Acknowledgments

I understand that my code is really messy and there are a lot of improvements needed to be made. My background is not perfect lol

license: MIT


text:
# Node
- The ast node I have defined

# Program
- Nodes
- nameTable (where are all the names located)

VS Code -> Language Service

onFileChanged(filepath, contents) -> service.updateFile(filepath, contents)
* filepath: absolute file path
* contents: string contents of file

getDocumentSymbols(filepath) -> service.getDocumentSymbols(filepath):
                                    -> service.getDocumentUsages(filepath)
                                    -> service.getDocumentDeclarations(filepath)
* in: filepath: absolute file path
* out:
  * name: string
  * kind: SymbolKind
  * containerName: string
  * location: Location (uri and line/col)

getWorkspaceSymbols -> service.getWorkspaceDeclarations
* out:
  * name: string
  * kind: SymbolKind
  * containerName: string
  * location: Location (uri and line/col)

provideReferences(document, position, includeDeclaration) ->
                                service.getAllSymbolReferences(symbolPath)
                                    -> service.getSymbolDeclaration(symbolPath)
                                    -> service.getSymbolUsages(symbolPath)
* out:
  * location: Location (uri and line/col)

repository: hoovercj/jotdown

repo_name: hoovercj/jotdown


text:
I wanted to cross compile Leptonica on Linux, Fedora 30 in my case, using
the MXE cross compile libraries. To do this I modified the makefile.static
file in the leptonica/src directory as suggested on the Leptonica website.

My MXE installation is in '/opt/mxe'. If you have put it elsewhere then
you will need to modify the paths appropriately.

I first ran ./make-for-local which copies src/makefile.static to
src/makefile. Then I modified 'makefile' to allow the use of a COMPILER flag.

So if you want to use these files you should copy makefile into the leptonica/src
directory 'cd  src' to move to that directory and run make with one of the
following commands.

All versions create a library called 'liblept.a'.

- 'make' This will create a no debug static library using your local gcc in leptonica/nodebug.
- 'make COMPILER=GCC' This is exactly the same as above as GCC is the default.
- 'make DEBUG=yes debug' This will create a debug static library sing your local gcc in leptonica/debug.
- 'make COMPILER=GCC DEBUG=yes debug' This is exactly the same as above as GCC is the default.
- 'make COMPILER=MXE_GCC_STATIC' This will create a no debug static library using the MXE static gcc in leptonica/nodebug.
- 'make COMPILER=MXE_GCC_STATIC DEBUG=yes debug'  This will create a debug static library using the MXE static gcc in leptonica/nodebug.

There is a COMPILER=MXE_GCC_SHARED flag but that doesn't work at the moment
and as I don't want the shared library at the moment I haven't tried to
fault find it.

You can chain the methods together and so long as you don't 'make clean,
all the files will be created in separate directories.

make; make DEBUG=yes debug; make COMPILER=MXE_GCC_STATIC; make COMPILER=MXE_GCC_STATIC DEBUG=yes debug

will create both unix and mingw debug and nodebug static libraries.

I am placing all my created library files in a central location
under ~/workspace/lib.

lib
lib/unix
lib/unix/lib # 'liblept.a' and 'libleptd.a' (the debug version was renamed to unix style)
lib/unix/include
lib/mingw64
lib/mingw64/release
lib/mingw64/release/lib
lib/mingw64/release/include
lib/mingw64/debug
lib/mingw64/debug/lib
lib/mingw64/debug/include

the shell script install.sh makes this directory structure and copies the
various '*.h' files and the "*.a" library files into this structure.

I am certain that there is a more elegant way to do this but it works and
I don't have the time to chase down faults and/or a better method.
Maybe later if I get the time.

All this is placed under the MIT license so if it is of any use to you,
then use it.


text:
## 190814 (AzSK v.4.0.0)

### Feature updates

*	(Preview) Restructuring of DevOps Kit framework for reusability:
	*	From the learnings of developing DevOps Kit-based AAD & ADO scanners, we have done an extensive refactoring exercise to make it easy to leverage core framework capabilities to create security/compliance scanners for other technology areas.

*	Privileged Identity Management (PIM):
	*	The following new switches have been added to PIM cmdlets:
	*	-ListSoonToExpireAssignments switch in Get-AzSKPIMConfiguration cmdlet to list eligible assignments that will expire within specified duration.
	*	-ExtendExpiringAssignments switch in Set-AzSKPIMConfiguration cmdlet to extend the eligibility of assignments by a specified duration.

*	(Preview) Credential Hygiene:
	*	Credential hygiene events generated via control scan will now be send to DevOps Kit configured log analytics workspace.
	*	We have also introduced New-AzSKTrackedCredentialGroup cmdlet to configure email alerts to notify users about AzSK-tracked credentials that are about to expire or have already expired.

*	(Preview) Approved exception support in control attestation:
	*	The control attestation feature has been augmented to support a special “GRC-approved” exception for controls. This covers scenarios where controls cannot be passed due to limitations/conditions beyond the realm of application teams (e.g., a product bug). It can be triggered by using the new -AddException switch during attestation.

*	Security Verification Tests (SVTs):
	*   Support for severity-based filter for Get-AzSKControlsStatus (GACS) command.

*	ARM Template Checker:
	*	N/A

*	CICD:
	*	Support for a switch to toggle whether to ‘pass’ or ‘fail’ the pipeline if no controls are scanned via SVT and 	    ARM Checker task (default is ‘fail’).
	*	This flag is useful in situations where due to scan criteria (e.g., -Severity ‘Critical’) no controls might be      scanned when the task runs.

*	(Preview) In-cluster security scans for ADB, AKS, HDI Spark
	*	In-cluster CA now supports sending scan telemetry to log analytics (LA) workspace. This can be configured by 	    using the Install-AzSKContinuousAssuranceForCluster cmdlet. (If no LA workspace is specified, the workspace         configured for the regular DevOps Kit CA in the subscription will be used.)
	*	The DevOps Kit monitoring solution (Install-AzSKMonitoringSolution) views will now show in-cluster compliance       status for your HDInsight and Databricks workspaces.

*	Log Analytics:
	*	N/A

*	Org-policy updates (for non-CSEO users):
	*	Fixed an issue in Get-AzSKOrganizationPolicyStatus cmdlet where in local debugging mode, extension files            weren't getting loaded.
	*	Fixed an issue in Get-AzSKOrganizationPolicyStatus cmdlet checks which were failing after fresh installation of     org-policy.
	*	Improved messages in the org-policy cmdlets (Install, Get & Update- org policy).
	*	Introduced DisableOrgPolicyCheckForSession flag in Set-AzSKPolicySettings cmdlet to disable enforcement of          org-policy for the current PS session. This helps in situations when an org-policy owner is working with            multiple side-by-side policies.

Note: The next few items mention features from recent releases retained for visibility in case you missed those release announcements:

*	Privileged Identity Management (PIM) helper cmdlets (from last sprint)
	*	Set-AzSKPIMConfiguration for configuring/changing PIM settings
	*	Get-AzSKPIMConfiguration for querying various PIM settings/status
	*	Activating your PIM role is now as simple as this:
		pim -ActivateMyRole -SubscriptionId $s5 -DurationInHours 8 -Justification 'ad hoc test' -RoleName Owner
	*	See docs [here](https://github.com/azsk/DevOpsKit-docs/blob/master/01-Subscription-Security/Readme.md#azsk-privileged-identity-management-pim-helper-cmdlets-1) for more.

*	(Preview) Security Scan for Azure Active Directory (AAD)
	*	You can scan security controls for your AAD tenant (as either an admin or even as a regular user) using the DevOps Kit AAD Security Scan module.
	*	Use following steps:
		 AAD scan cmdlets are packaged as a separate module (AzSK.AAD)
		```Powershell
		Install-module AzSK.AAD -Scope CurrentUser -AllowClobber
		Import-module AzSK.AAD
		Get-AzSKAADSecurityStatusTenant    # to check the tenant (admin)
		Get-AzSKAADSecurityStatusUser      # to check objects you own (user)
		```
	*	Caveats:
		*	Do not run these in the same PS session as AzSK. Start a new PS console.
		*	Az- modules require .Net Framework v4.7.2.
		*	By default, the current cmdlets will scan just 3 objects of each type (Apps/SPNs/Groups, etc.). This is until we work out how best to group/batch scans when scanning the entire tenant. If you want to scan more objects you can use the ‘-MaxObj’ switch in the cmdlets.

*	(Preview) AzSK module for Azure DevOps (VSTS)
	*	You can try the scan cmdlet using:
  		#VSTS scan cmdlet is in a separate module called AzSK.AzureDevOps!
  		Install-Module AzSK.AzureDevOps -Scope CurrentUser -AllowClobber
  		Get-AzSKAzureDevOpsSecurityStatus -OrganizationName "MicrosoftIT"`
                                    -ProjectNames "OneITVSO"`
                                    -BuildNames "build_name_here"`
                                    -ReleaseNames "release_name_here"
.
*	Org-policy updates (for non-CSEO users):
	*	See CA section in “Other improvements/bug fixes” below to install CA in environments where subscription ownership resides with a different team.

### Other improvements/bug fixes

*	Subscription Security:
	*	N/A

*	SVTs:
	*	N/A

*	Controls:
	*	The behavior for the controls ‘Azure_Subscription_AuthZ_Dont_Grant_Persistent_Access_RG, 	                        Azure_Subscription_AuthZ_Dont_Grant_Persistent_Access’ has been enhanced to check persistent access of users        and groups on resource group and subscription scope respectively.
	*	VM control ‘Azure_VirtualMachine_SI_Enable_Antimalware’ has been improved by adding Sophos antivirus check for      Linux VMs.
	*	Added a new control ‘Azure_VirtualMachine_SI_Deploy_Required_Extension’ which can be used by organizations to       specify which VM extensions are mandatory across the org. Different sets of extensions can be specified for         Windows and Linux VMs.

*	ARM Template Checker:
	*	N/A

*	CA:
	*	N/A

*	Privileged Identity Management (PIM)
	*	Fixed an issue where Set-AzSKPIMConfiguration cmdlet was not working due to a recent change in the PIM API.
	*	Set-AzSKPIMConfiguration cmdlet alias has been renamed to setpim (previously aliased as pim).

*	Azure DevOps (VSTS)
	*	Fixed a bug where a control scan was throwing an exception if no pool agents were found in the project.

*	Log Analytics (OMS)
	*	N/A

*	Other
	*	GenerateFixScript flag now works for subscription ARM policy compliance control.
	*	Updated the fix-script for the control 'Azure_AppService_BCDR_Use_Multiple_Instances'.
	*	Fixed an issue in Get-AzSKInfo -InfoType SubscriptionInfo whereby incorrect CA runbook version was being            reported.
	*	Fixed an issue to respect the -UsePreviewBaselineControls switch in Get-AzSKInfo -InfoType ControlInfo.

*	AzSK has been upgraded to use the latest Azure PowerShell libraries (Az v.2.4.0).

repository: azsk/DevOpsKit-docs

gha_language: PowerShell

gha_license_id: MIT

repo_name: azsk/DevOpsKit-docs


text:
## High-level overview of search package

The search module sits between a user's search request and our ElasticSearch cluster. It is responsible for converting the query string from a user's request into an ElasticSearch query, executing the query, gathering the raw results, and formatting them in a way that the frontend expects. The general goal is to keep each of these steps as decoupled as possible so that it's easy to reuse and extend the functionality in new views. For examples it's possible to create a new way of building up a query or formatting raw results and drop them into place without modifying the surrounding components.

How this package is used to create Pyramid views can be seen in **src/snowflakes/search_views.py** and **src/snowflakes/tests/test_searchv2.py**. There are extensive tests for every component (e.g. **snovault/tests/test_searches_responses.py**) that document expected behavior.

### Object relationships

Pyramid view (**snowflakes.search_views.py**) -> renders *FieldedResponse* (**responses.py**) -> contains many *ResponseFields* (**fields.py**)

### Manifest of modules
* configs.py - Specialized helper classes for filtering parameters passed to certain ElasticSearch aggregations
* decorators.py - General helper decorators for exception handling and dict filtering
* defaults.py - Default parameters and templates used in query building (ALL_CAPS variables)
* __fields.py__ - Classes that define the fields that are returned in JSON, specifically subclasses for different types of searches, matrices, etc.
* interfaces.py - Constants that alias raw strings (ALL_CAPS variables)
* __mixins.py__ - Classes mixed in to *FieldedResponse* that allow for flexible formatting of raw ElasticSearch results
* __parsers.py__ - Class for parsing and maniuplating the query string passed in by the user
* __queries.py__ - Classes and subclasses for generating specific Elasticseach queries
* __responses.py__ - Classes for wrapping raw ElasticSearch responses (*QueryResponse* and subclasses) and Pyramid view responses (*FieldedReponse* and subclasses)

\* Note that bolded modules contain core functionality, unbolded are less important/contain implementation details.

### Longer Examples

Every *ResponseField* has a render() method that returns a dictionary with keys and values. The *ResponseFields* can be as simple or as complicated as you want as long as their render method returns a dictionary of data. The *FieldedResponse* merges all of the dictionaries from the *ResponseFields* it contains and passes it to Pyramid to render as a view.

A simple example just returns a hardcoded dictionary:

- *SimpleResponseField*.render() -> return {"@graph": [1, 2, 3]}

A real example:

- The *BasicSearchResponseField* splits up its rendering into three parts:
    - (1) Build an ElasticSearch query
    - (2) Execute the query and gather raw search results
    - (3) Format raw search results into dictionary used by frontend

All of these steps call other classes to do the work for them.

**In the case of (1) Building an ElasticSearch query:**
-  The *BasicSearchResponseField* uses the *BasicQueryFactory* (**queries.py**) which inherits from *AbstractQueryFactory*
- *AbstractQueryFactory* has all of the basic methods required to build up an ElasticSearch query (e.g. adding filters, aggregations, etc.). It makes use of another class called *ParamsParser* (**parsers.py**) that makes parsing the query string passed in by the user convenient (and tested!). For example:
    - method to pull all of the params that match a key (e.g. field=status)
    - method to split params by whether they are equal (status=released) or not equal (status!=in progress)
    - method to split params by whether they are exists (s3_uri=\*) or not exists (s3_uri!=\*)
- *AbstractQueryFactory* has a method called build_query() that is not implemented. The point is to have the subclasses of *AbstractQueryFactory* use this method to define how they should build up their specific queries. The subclasses should make use of the common methods in the *AbstractQueryFactory* class or implement their own private helper methods. Ideally any additional functionality will be an extension (new class that wraps base functionality) rather than a revision of the base class.
- Example of steps in *BasicQueryFactory*.build_query():
    - validate_item_types() - checks to see if the types (e.g. Experiment, File, etc.) passed in by the user are valid types
    - add_simple_query_string_query() - adds searchTerm=... value to raw ES query
    - add_query_string_query() - adds advancedQuery=... value to raw ES query
    - add_filters() - adds filters such as status=released or assay_title=Chip-seq to raw ES query
    - add_post_filters() - adds permission filters based on viewing permission of user to raw ES query
    - add_source() - adds raw fields to return from ES (we store multiple views e.g. object, embedded in ES and only return a subset of fields)
    - add_slice() - adds limit=100 or limit=all to raw ES query
    - --> returns the raw ES query

**In the case of (2) Execute the query and gather raw search results:**
- passes the query built up in previous step to ES cluster
- raw results wrapped in *BasicQueryResponseWithFacets* (**responses.py**) which has mixins (**mixins.py**) for rendering specific raw output types (e.g. aggregations are converted from raw form to something that frontend expects, namely *facets*). Mixins allow for flexible extension of rendering capabilities based on context.

**In the case of (3) Format raw search results into dictionary used by frontend:**
- *BasicQueryResponseWithFacet* mixin methods (e.g. *to_hits*, *to_facets*) are called and return a dictionary with *@graph* and *facets* fields to the *BasicSearchResponseField*:
```
{"@graph": [{"accession": "ENCFFABC123"}, {"accession": "ENCFFABC456"}], "facets": [{"assay_titles": [1, 2, 3]}]}
```

The *BasicSearchResponseField* is only responsible for building and executing the query and formatting the raw response (all of which are delegated to other classes). There are other fields that we want to add to the JSON response, such as *title*, *@id*, *@type* etc. These are all individually encapsulated in their own *ResponseField* subclasses.

For example: *TitleResponseField*.render() --> return {"title": "Experiment"}

Some of these are very simple methods, but others are very complex/have multiple steps/dependencies. Having a common interface to all makes wrapping and rendering arbitrary code convenient. It also allows components to be reusable and insulated from changes in other parts of the system.

In the case of other types of ElasticSearch queries there are other subclasses of *AbstractQueryFactory* that build specific queries, e.g. *BasicMatrixQueryFactory* (**queries.py**). In many cases these share a lot of the same functionality as the parent classes but will have additional steps (e.g. adding specific aggregations needed by the Experiment matrix), or will override certain parent methods (e.g. raising an error if more than one type is specified in matrix query string).

repository: Lattice-Data/snovault

branch_name: refs/heads/dev

gha_language: Python

repo_name: Lattice-Data/snovault


text:
---
title: "Single Cell RNAseq Part 1"
author: "Bioinformatics Core"
output:
    html_document:
      keep_md: TRUE
---

# Single Cell Analysis with Seurat and some custom code!

[Seurat](http://satijalab.org/seurat/) is a popular R package that is designed for QC, analysis, and exploration of single cell RNA-seq data. Seurat aims to enable users to identify and interpret sources of heterogeneity from single cell transcriptomic measurements, and to integrate diverse types of single cell data. Further, the authors provide several [tutorials](http://satijalab.org/seurat/get_started.html), on their website.

Download and expand the expression_tables_cellrangerV3.zip file to extract the single cell matrix files for the three samples. These are isolated mouse cells ran on the 10X genomics platform (3' expression V2) for single cell RNA sequencing, sequenced with UC Davis on 1 HiSeq 4000 lane. The Experiment contains 3 samples, each merged from 2 original samples and then randomly subsamples to 1000 cells each.

The three samples are, Dorsal root ganglion neurons :
At weaning, Ttpa+/+ mice were fed a normal diet (35 mg of dl-α-tocopheryl acetate/kg, vitE+) while and Ttpa-/- mice were fed either an α-TOH-deficient diet (<10 mg of dl-α-tocopheryl acetate/kg, vitE-), or α-TOH-supplemented diet (600 mg of dl-α-tocopheryl acetate/kg, vitE+++) diet.

* UCD_Adj_VitE - normal + Vitamin E
* UCD_Supp_VitE - Vitamin E supplimented by diet.
* UCD_VitE_Def - Vitamin E deficient animals

We start with loading needed libraries for R, at this time all we need is the package [Seurat](http://satijalab.org/seurat/).

```r
library(Seurat)
```

## Load the Cell Ranger Matrix Data and create the base Seurat object.
Cell Ranger provides a function `cellranger aggr` that will combine multiple samples into a single matrix file. However, when processing data in R and Seurat this is unnecessary and we can aggregate them in R.

Seurat provides a function `Read10X` to read in 10X data folder. First we read in data from each individual sample folder. First, we initialize the Seurat object (`CreateSeuratObject`) with the raw (non-normalized data). Keep all genes expressed in >= 10 cells. Keep all cells with at least 200 detected genes. Also extracting sample names, calculating and adding in the metadata mitochondrial percentage of each cell. Adding in the metadata batchid and cell cycle. Finally, saving the raw Seurat object.

```r
dataset_loc <- "./expression_tables_cellrangerV3"
ids <- c("UCD_Adj_VitE", "UCD_Supp_VitE", "UCD_VitE_Def")

d10x.data <- sapply(ids, function(i){
  d10x <- Read10X(file.path(dataset_loc,i,"outs/filtered_feature_bc_matrix"))
  colnames(d10x) <- paste(sapply(strsplit(colnames(d10x),split="-"),'[[',1L),i,sep="-")
  d10x
})

experiment.data <- do.call("cbind", d10x.data)

experiment.aggregate <- CreateSeuratObject(
  experiment.data,
  project = "scRNA workshop",
  min.cells = 10,
  min.features = 200,
  names.field = 2,
  names.delim = "\\-")
```

### The percentage of reads that map to the mitochondrial genome

* Low-quality / dying cells often exhibit extensive mitochondrial contamination.
* We calculate mitochondrial QC metrics with the PercentageFeatureSet function, which calculates the percentage of counts originating from a set of features.
* We use the set of all genes, in mouse these genes can be identified as those that begin with 'mt', in human data they begin with MT.

```r
experiment.aggregate$percent.mito <- PercentageFeatureSet(experiment.aggregate, pattern = "^mt-")
```

## Calculate cell cycle, add to meta data
Using the package scran, get the mouse cell cycle markers and a mapping of m

```r
mm.pairs <- readRDS(system.file("exdata", "mouse_cycle_markers.rds", package="scran"))
# Convert to matrix for use in cycle
mat <- as.matrix(GetAssayData(experiment.aggregate))

# Convert rownames to ENSEMBL IDs, Using biomaRt
#ensembl<- useMart(biomart = "ensembl", dataset = "mmusculus_gene_ensembl")
#anno_data <- getBM( values=rownames(mat), attributes=c("mgi_symbol","ensembl_gene_id") , filters= "mgi_symbol"  ,mart=ensembl)
# Downloaded from Biomart
#download.file("https://raw.githubusercontent.com/ucdavis-bioinformatics-training/2019-single-cell-RNA-sequencing-Workshop-UCD_UCSF/master/scrnaseq_analysis/mart_export_June2019.txt", "mart_export_June2019.txt")
anno <- read.delim("mart_export_June2019.txt")

ord <- match(rownames(mat), anno$MGI.symbol) # use anno$mgi_symbol if via biomaRt
rownames(mat) <- anno$Gene.stable.ID[ord] # use anno$ensembl_gene_id if via biomaRt
drop <- which(is.na(rownames(mat)))
mat <- mat[-drop,]
cycles <- scran::cyclone(mat, pairs=mm.pairs)
tmp <- data.frame(cell.cycle = cycles$phases)
rownames(tmp) <- colnames(mat)
experiment.aggregate <- AddMetaData(experiment.aggregate, tmp)
```

### Lets create a fake batch metadata (used in part 3), Here we determine UCD_Adj_VitE is from one batch and UCD_Adj_VitE/UCD_Adj_VitE are from a second battch

Here we build a new metadata variable 'batchid' which can be used to specify treatment groups.

```r
samplename =<EMAIL_ADDRESS>table(samplename)
```

```
## samplename
##  UCD_Adj_VitE UCD_Supp_VitE  UCD_VitE_Def
##           904          1000           992
```

```r
batchid = rep("Batch1",length(samplename))
batchid[samplename %in% c("UCD_Adj_VitE")] = "Batch2"
names(batchid) =<EMAIL_ADDRESS>
experiment.aggregate <- AddMetaData(
  object = experiment.aggregate,
  metadata = batchid,
  col.name = "batchid")

table(experiment.aggregate$batchid)
```

```
##
## Batch1 Batch2
##   1992    904
```

### Lets spend a little time getting to know the Seurat object.

The Seurat object is the center of each single cell analysis. It stores __all__ information associated with the dataset, including data, annotations, analyses, etc. The R function slotNames can be used to view the slot names within an object.

```r
slotNames(experiment.aggregate)
```

```
##  [1] "assays"       "meta.data"    "active.assay" "active.ident"
##  [5] "graphs"       "neighbors"    "reductions"   "project.name"
##  [9] "misc"         "version"      "commands"     "tools"
```

We can then view the data within a slot with the `@` operator.

```r
<EMAIL_ADDRESS>```

```
##                                  orig.ident nCount_RNA nFeature_RNA
## ACTCTAATGTGGGTATG-UCD_Adj_VitE UCD_Adj_VitE       8885         2818
## AGGCTGGTCAATCACAC-UCD_Adj_VitE UCD_Adj_VitE       5019         2167
## ATGACTAGCACATGACT-UCD_Adj_VitE UCD_Adj_VitE       2208         1286
## AAGCGTCGTCTCTAAGG-UCD_Adj_VitE UCD_Adj_VitE       2795         1474
## ACATCGGGTCCATGCTC-UCD_Adj_VitE UCD_Adj_VitE       5372         2271
## ATACGGTAGTGACCAAG-UCD_Adj_VitE UCD_Adj_VitE        598          367
##                                percent.mito cell.cycle batchid
## ACTCTAATGTGGGTATG-UCD_Adj_VitE     1.969612         G1  Batch2
## AGGCTGGTCAATCACAC-UCD_Adj_VitE     6.216378         G1  Batch2
## ATGACTAGCACATGACT-UCD_Adj_VitE     6.838768         G1  Batch2
## AAGCGTCGTCTCTAAGG-UCD_Adj_VitE     4.221825         G1  Batch2
## ACATCGGGTCCATGCTC-UCD_Adj_VitE     7.557707         G1  Batch2
## ATACGGTAGTGACCAAG-UCD_Adj_VitE    11.371237         G1  Batch2
```

#### Question(s)

1. What slots are empty, what slots have data?
2. What columns are available in meta.data?
3. Look up the help documentation for subset?

## Finally, save the original object, write out a tab-delimited table that could be read into excel, and view the object.

```r
write.table(as.matrix(experiment.data),"raw.datatable.txt",sep="\t",col.names=T,row.names=T)
experiment.aggregate
```

```
## An object of class Seurat
## 12811 features across 2896 samples within 1 assay
## Active assay: RNA (12811 features)
```

```r
## Original dataset in Seurat class, with no filtering
save(experiment.aggregate,file="original_seurat_object.RData")
```

## Get the next Rmd file

```r
download.file("https://raw.githubusercontent.com/ucdavis-bioinformatics-training/2019-single-cell-RNA-sequencing-Workshop-UCD_UCSF/master/scrnaseq_analysis/scRNA_Workshop-PART2.Rmd", "scRNA_Workshop-PART2.Rmd")
```

## Session Information

```r
sessionInfo()
```

```
## R version 3.6.0 (2019-04-26)
## Platform: x86_64-apple-darwin15.6.0 (64-bit)
## Running under: macOS Mojave 10.14.5
##
## Matrix products: default
## BLAS:   /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRblas.0.dylib
## LAPACK: /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRlapack.dylib
##
## locale:
## [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
##
## attached base packages:
## [1] stats     graphics  grDevices utils     datasets  methods   base
##
## other attached packages:
## [1] Seurat_3.0.2
##
## loaded via a namespace (and not attached):
##   [1] ggbeeswarm_0.6.0            Rtsne_0.15
##   [3] colorspace_1.4-1            ggridges_0.5.1
##   [5] dynamicTreeCut_1.63-1       XVector_0.24.0
##   [7] GenomicRanges_1.36.0        BiocNeighbors_1.2.0
##   [9] listenv_0.7.0               npsurv_0.4-0
##  [11] ggrepel_0.8.1               codetools_0.2-16
##  [13] splines_3.6.0               R.methodsS3_1.7.1
##  [15] lsei_1.2-0                  knitr_1.23
##  [17] scater_1.12.2               jsonlite_1.6
##  [19] ica_1.0-2                   cluster_2.1.0
##  [21] png_0.1-7                   R.oo_1.22.0
##  [23] sctransform_0.2.0           compiler_3.6.0
##  [25] httr_1.4.0                  dqrng_0.2.1
##  [27] assertthat_0.2.1            Matrix_1.2-17
##  [29] lazyeval_0.2.2              limma_3.40.2
##  [31] BiocSingular_1.0.0          htmltools_0.3.6
##  [33] tools_3.6.0                 rsvd_1.0.1
##  [35] igraph_<IP_ADDRESS>              gtable_0.3.0
##  [37] glue_1.3.1                  GenomeInfoDbData_1.2.1
##  [39] RANN_2.6.1                  reshape2_1.4.3
##  [41] dplyr_0.8.1                 Rcpp_1.0.1
##  [43] Biobase_2.44.0              gdata_2.18.0
##  [45] ape_5.3                     nlme_3.1-140
##  [47] DelayedMatrixStats_1.6.0    gbRd_0.4-11
##  [49] lmtest_0.9-37               xfun_0.7
##  [51] stringr_1.4.0               globals_0.12.4
##  [53] irlba_2.3.3                 gtools_3.8.1
##  [55] statmod_1.4.32              future_1.13.0
##  [57] edgeR_3.26.5                MASS_7.3-51.4
##  [59] zlibbioc_1.30.0             zoo_1.8-6
##  [61] scales_1.0.0                parallel_3.6.0
##  [63] SummarizedExperiment_1.14.0 RColorBrewer_1.1-2
##  [65] SingleCellExperiment_1.6.0  yaml_2.2.0
##  [67] reticulate_1.12             pbapply_1.4-0
##  [69] gridExtra_2.3               ggplot2_3.2.0
##  [71] stringi_1.4.3               S4Vectors_0.22.0
##  [73] scran_1.12.1                caTools_<IP_ADDRESS>
##  [75] BiocGenerics_0.30.0         BiocParallel_1.18.0
##  [77] bibtex_0.4.2                GenomeInfoDb_1.20.0
##  [79] Rdpack_0.11-0               SDMTools_1.1-221.1
##  [81] rlang_0.3.4                 pkgconfig_2.0.2
##  [83] bitops_1.0-6                matrixStats_0.54.0
##  [85] evaluate_0.14               lattice_0.20-38
##  [87] ROCR_1.0-7                  purrr_0.3.2
##  [89] htmlwidgets_1.3             cowplot_0.9.4
##  [91] tidyselect_0.2.5            plyr_1.8.4
##  [93] magrittr_1.5                R6_2.4.0
##  [95] IRanges_2.18.1              gplots_<IP_ADDRESS>
##  [97] DelayedArray_0.10.0         pillar_1.4.1
##  [99] fitdistrplus_1.0-14         survival_2.44-1.1
## [101] RCurl_1.95-4.12             tibble_2.1.3
## [103] future.apply_1.3.0          tsne_0.1-3
## [105] crayon_1.3.4                KernSmooth_2.23-15
## [107] plotly_4.9.0                rmarkdown_1.13
## [109] viridis_0.5.1               locfit_1.5-9.1
## [111] grid_3.6.0                  data.table_1.12.2
## [113] metap_1.1                   digest_0.6.19
## [115] tidyr_0.8.3                 R.utils_2.9.0
## [117] stats4_3.6.0                munsell_0.5.0
## [119] beeswarm_0.2.3              viridisLite_0.3.0
## [121] vipor_0.4.5
```


text:
---
name: "\U0001F381 Feature Request"
about: Do you have ideas for new features or improvements?
title: ''
labels: kind/feature, status/triage
assignees: ''

---

<!--
    Hi there! Thank you for submitting a feature request!

    Before you submit your issue, please review and follow the instructions at
    https://python-poetry.org/docs/contributing/#suggesting-enhancements.
-->

<!-- All the below steps should be completed before submitting your issue. Checked checkbox should look like this: [x] -->
- [ ] I have searched the [issues](https://github.com/python-poetry/poetry/issues) of this repo and believe that this is not a duplicate.
- [ ] I have searched the [FAQ](https://python-poetry.org/docs/faq/) and general [documentation](https://python-poetry.org/docs/) and believe that my question is not already covered.

## Feature Request
<!-- Now feel free to write your issue, and please be as descriptive as possible! -->
<!-- Thanks again 🙌 ❤ -->

repository: python-poetry/poetry

repo_name: python-poetry/poetry


text:
This repo contains a project (written in python) that can create a Non-Deterministic Finite Automaton (NFA) from a regular expression and then use this NFA to check if any given string of text matches the regular expression.

The program will:
- Parse the regular expression from infix to postfix notation.
- Build a series of small non-deterministic finite automaton (NFA) for parts of the regular expression.
- Combine these small NFA's to create the over all NFA.
- Implement a series of functions to compare each character in the string of text to the NFA to see if the regular expression matches the string of text.

Dependencies needed in development:
- VI 8.1
- Python 2.7.16
- git version 2.20.1
- gcc (Debian 8.3.0-6) 8.3.0
- Wget 1.20.1

***

**Running the program from VI**:
- CD into the GraphTheoryProject folder containing the necessary files.
- Enter "python3 runner.py" to execute the runner file.
- The program will then ask you to enter the string of text e.g. "aaab"
- Next you will be asked to enter the regular expression e.g. "a*"
- The program will then return True or False depending on whether your string matches
the regular expression.

**Testing the program**:
- To test the program, I created a seperate python script file called testCases.py
- This file contains an array of test cases.
- Each test case in the array is it's own array in the format [String, String, Boolean].
- The first string in the array represents the regular expression.
- The second string is text to which the regex will be compared.
- And the boolean value represents the expected result.
- The match function was imported from nfa.py
- The match function was then asserted for each test case in the array using a for loop.
- The last param of the assert method is an if/else statement,
which will indicate to the user if a test case was successful/unsuccessful.

***

Before I begin describing how the code works, here is the layout of the files and their contents:

**nfa.py**:
(*functions*)
- shunt()
- regex_compile()
- loopForEpsilons()
- loopForMatches()
- compareStringToNFA()
- match()

- An if statement to determine if nfa.py is run as main.

**runner.py**:
This class just contains two variables for the regular expression and the text.
The match function is imported from nfa.py, executed and the result printed to the console.

**testCases.py**:
- An array of test cases.
- A for loop to filter through them.
- An assert method to test the match method (imported from nfa).

**thompsons.py**:
(*classes*)
- State - representing the states of an NFA.
- Fragment - representing the fragments of an NFA.

### **How the program works**:
- After the user has entered the string of text and the regular expression,
the match() function is called, which will take in these two parameters.
- The first thing this function will do is call the regex_compile() method,
taking the regular expressioon as a parameter.
- This method will then call the shunt() method. This method utilises the shunting
yard algorithm to convert the regular expression from infix notation to postfix notation.
- Next, inside regex_compile, the postfix string will then be converted to a stack.
This stack of characters will then be examined by a series of if/elif statements.
- These if/elif statements will use the characters from the postfix, along with the
 Fragment and State classes to create the over-all NFA.
- If the character in the regular expression is a letter, a simple fragment will be
created with a start and accept state, connected by an edge and a label marked with
the character.
- Or if the character in the regular expression is an operator (*, +...), then accordingly,
a new start and accept state will be created and connected to the simple fragment, with
new edges, fragments etc., so that the new NFA will properly represent the operator and
 correctly execute the string of text.
- The NFA is then returned to the match method and stored in a variable called 'nfa'.
- Next in the match method, the compareStringToNFA() boolean method is called, taking
the nfa and the string of text as parameters.
- This method first calls the loopForEpsilons method, which takes in the start of the NFA
and a set. It will proceed to loop through the NFA in search states connected by epsilons
 (labels marked None) whilst adding these states to a set.
- The compareStringToNFA method will then loop through each character in the string of
text and call upon a function called loopForMatches(). This method will search the through
this list of states connected by labels marked with the same character as the current one in
execution. All of these new states that follow the matching labels will also be added to a set.
- After this method, the compareStringToNFA method will then check if the accept state
of the NFA is present in this set of states. A boolean variable is then returned to the match
function (True if the accept state is present).
- The match function will then return this boolean variable to the user: True if the string is a
match, or False otherwise.


text:
---
title: Devlog 7
summary: Transition of thought
date: 2019-11-26

reading_time: false
profile: false
comments: false

header:
  caption: ""
  image: ""

authors: ["admin"]

---

I've been considering how my work has evolved through the process of this project.

I initially wanted to create a queered social media platform that contested a national narrative. I wanted to tell a story that transgressed borders and realities, and I considered doing so by fictionalizing queer history. I imagined something like a FaceBook page with a rainbow theme that demonstrated freedom of speech over a series of social media posts created by fictionalized and queered people. I reconsidered this project based on the amount of work in creating a FaceBook-esque platform, and the ethicality of generating queer text.

My next idea was to train an AI model on the German archival documents I'm analyzing for my Masters dissertation. I ran a series of tests on an AI software modeled on reddit, and quickly abandoned that idea.

 The problem of user agency diametrically opposed the authoritarian regime I was simulating, but this idea proved the most managable and ethical and the least problematic.

repository: Sabrina-Schoch/academic-kickstart

gha_language: Shell

repo_name: Sabrina-Schoch/academic-kickstart


text:
# Tesla Clone
A Tesla clone built using [React](https://reactjs.org/), [TypeScript](https://www.typescriptlang.org/) and [Styled Components](https://styled-components.com/).

## Live Demo
[https://tesla-clone-d4fd3.web.app/](https://tesla-clone-d4fd3.web.app/)

## How it works
- Redux is used to store the car names, which is used in the navigation bar
- This is just a dummy site of the Tesla Website

## Built using
- [React](https://reactjs.org/)
- [TypeScript](https://www.typescriptlang.org/)
- [Redux](https://redux.js.org/)
- [Styled Components](https://styled-components.com/)
- [react-awesome-reveal](https://www.npmjs.com/package/react-awesome-reveal)
- [Material UI Icons](https://material-ui.com/)

## Platform
Hosted thorugh [Firebase](https://firebase.google.com/).

## License
Code released under the [MIT License](https://github.com/Tushar-Indurjeeth/Tesla-Clone/blob/91eb6234f45bf01cd7147d14c98820d9532980d3/LICENSE).

repository: Tushar-Indurjeeth/Tesla-Clone

branch_name: refs/heads/main

repo_name: Tushar-Indurjeeth/Tesla-Clone


text:
---
layout: default
---

# 1997-10-24 - Forgery

## Header Data

From: bureau42 Anonymous Remailer<EMAIL_ADDRESS>To<EMAIL_ADDRESS>Message Hash:<PHONE_NUMBER>c54cd5be56dc85f2bcda05b32317d277499bddf8a9e855f2805a47

Message ID<EMAIL_ADDRESS>Reply To: _N/A_

UTC Datetime: 1997-10-24 17:07:04 UTC

Raw Date: Sat, 25 Oct 1997 01:07:04 +0800

## Raw message

```
{% raw  %}From: bureau42 Anonymous Remailer<EMAIL_ADDRESS>Date: Sat, 25 Oct 1997 01:07:04 +0800
To<EMAIL_ADDRESS>Subject: Forgery
Message-ID<EMAIL_ADDRESS>MIME-Version: 1.0
Content-Type: text/plain

Forgery is the sincerest form of plagiarism.

{% endraw %}
```

## Thread

+ Return to [October 1997](/archive/1997/10)

+ Return to "[bureau42 Anonymous Remailer <nobody@bureau42.ml.org>](/authors/bureau42_anonymous_remailer_nobody_at_bureau42_ml_org_)"

+ 1997-10-24 (Sat, 25 Oct 1997 01:07:04 +0800) - Forgery - _bureau42 Anonymous Remailer<EMAIL_ADDRESS>