Skip to content

Commit

Permalink
Update BJJ
Browse files Browse the repository at this point in the history
  • Loading branch information
pydanny committed Jun 11, 2024
1 parent 8288ef0 commit ee32b73
Show file tree
Hide file tree
Showing 5 changed files with 121 additions and 75 deletions.
2 changes: 1 addition & 1 deletion pages/about.mdoc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ I am a [coder](https://github.com/pydanny), [author](/books), and [speaker](/spe

I'm probably best known as "[pydanny](https://www.google.com/search?q=pydanny)", one of the authors of [Two Scoops of Django](/books/tech).

I love to hang out with my [wife](https://audrey.feldroy.com/), play with my [daughter](/tags/uma), do [Brazilian Jiu-Jitsu](https://en.wikipedia.org/wiki/Brazilian_jiu-jitsu), write [books](/books), and read books. I work at [Kraken Tech](https://kraken.tech/), a company that is part of the sustainable global energy [Octopus Energy Group](https://octopusenergy.group/) working to address [global climate change](/tags/climate-change).
I love to hang out with my [wife](https://audrey.feldroy.com/), play with my [daughter](/tags/uma), do [Brazilian Jiu-Jitsu](https://en.wikipedia.org/wiki/Brazilian_jiu-jitsu) at [Apex BJJ](https://www.apexbjj.co.uk/) in London, write [books](/books), and read books. I work at [Kraken Tech](https://kraken.tech/), a company that is part of the sustainable global energy [Octopus Energy Group](https://octopusenergy.group/) working to address [global climate change](/tags/climate-change).

- [Mastodon](https://fosstodon.org/@danielfeldroy)
- [LinkedIn](https://www.linkedin.com/in/danielfeldroy/)
Expand Down
95 changes: 59 additions & 36 deletions public/feeds/atom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<feed xmlns="http://www.w3.org/2005/Atom">
<id>https://daniel.feldroy.com/</id>
<title>Daniel Roy Greenfeld</title>
<updated>2024-06-04T13:23:23.887Z</updated>
<updated>2024-06-11T17:05:52.638Z</updated>
<generator>Next.js using Feed for Node.js</generator>
<author>
<name>Daniel Roy Greenfeld</name>
Expand All @@ -14,6 +14,64 @@
<logo>https://daniel.feldroy.com/images/pydanny-cartwheel.png</logo>
<icon>https://daniel.feldroy.com/favicon.ico</icon>
<rights>All rights reserved 2024, Daniel Roy Greenfeld</rights>
<entry>
<title type="html"><![CDATA[TIL: Passing exceptions as arguments in Python]]></title>
<id>https://daniel.feldroy.com/posts/til-2024-06-passing-exceptions-as-arguments-in-python</id>
<link href="https://daniel.feldroy.com/posts/til-2024-06-passing-exceptions-as-arguments-in-python"/>
<updated>2024-06-07T10:13:05.553Z</updated>
<summary type="html"><![CDATA[Mypy needs an extra identifier to not choke on an exception passed as an argument.]]></summary>
<content type="html"><![CDATA[<p><em>Mypy needs an extra identifier to not choke on an exception passed as an argument.</em></p>
<p>This will throw a mypy error:</p>
<pre><code class="language-python"># code.py
class MyException(Exception):
pass
def myfunc(custom_exception: Exception) -> None:
try:
print('Test')
except custom_exception:
print('error)
myfunc(MyException)
</code></pre>
<p>The error mypy will throw looks something like this:</p>
<pre><code class="language-bash">$ mypy code.py
code.py:6: error: Exception type must be derived from BaseException (or be a tuple of exception classes) [misc]
code.py:9: error: Argument 1 to "custom_exception" has incompatible type "type[MyException]"; expected "Exception" [arg-type]
Found 2 errors in 1 file (checked 1 source file)
</code></pre>
<p>The solution is to use <code>typing.Type</code>:</p>
<pre><code class="language-python"># code.py
from typing import Type
class MyException(Exception):
pass
def myfunc(custom_exception: Type[Exception]) -> None:
try:
print('Test')
except custom_exception:
print('error)
myfunc(MyException)
</code></pre>
]]></content>
<author>
<name>Daniel Roy Greenfeld</name>
<email>[email protected]</email>
<uri>https://daniel.feldroy.com</uri>
</author>
<category term="TIL"/>
<contributor>
<name>Daniel Roy Greenfeld</name>
<email>[email protected]</email>
<uri>https://daniel.feldroy.com</uri>
</contributor>
</entry>
<entry>
<title type="html"><![CDATA[TIL: Renaming git branches]]></title>
<id>https://daniel.feldroy.com/posts/til-2024-06-renaming-git-branches</id>
Expand Down Expand Up @@ -117,39 +175,4 @@ class Command(BaseCommand):
<uri>https://daniel.feldroy.com</uri>
</contributor>
</entry>
<entry>
<title type="html"><![CDATA[TIL: Auto setup remote branch for git]]></title>
<id>https://daniel.feldroy.com/posts/til-2024-05-auto-setup-remote-branch-for-git</id>
<link href="https://daniel.feldroy.com/posts/til-2024-05-auto-setup-remote-branch-for-git"/>
<updated>2024-05-21T08:38:05.180Z</updated>
<summary type="html"><![CDATA[For getting rid of the "fatal: The current branch new-awesome-feature has no upstream branch" error.]]></summary>
<content type="html"><![CDATA[<p><em>For getting rid of the "fatal: The current branch new-awesome-feature has no upstream branch" error.</em></p>
<p>Whenever I create a new branch and try to push the new commit then I start seeing this error:</p>
<pre><code>git push --force
fatal: The current branch new-awesome-feature has no upstream branch.
To push the current branch and set the remote as upstream, use
git push --set-upstream origin new-awesome-feature
To have this happen automatically for branches without a tracking
upstream, see 'push.autoSetupRemote' in 'git help config'.
</code></pre>
<p>To fix it so git just auto creates the branch, just enter this magic command:</p>
<pre><code class="language-bash">git config --global --add --bool push.autoSetupRemote true
</code></pre>
]]></content>
<author>
<name>Daniel Roy Greenfeld</name>
<email>[email protected]</email>
<uri>https://daniel.feldroy.com</uri>
</author>
<category term="TIL"/>
<category term="git"/>
<category term="howto"/>
<contributor>
<name>Daniel Roy Greenfeld</name>
<email>[email protected]</email>
<uri>https://daniel.feldroy.com</uri>
</contributor>
</entry>
</feed>
2 changes: 1 addition & 1 deletion public/feeds/django.atom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<feed xmlns="http://www.w3.org/2005/Atom">
<id>https://daniel.feldroy.com/</id>
<title>Daniel Roy Greenfeld</title>
<updated>2024-06-04T13:23:23.802Z</updated>
<updated>2024-06-11T17:05:52.549Z</updated>
<generator>Next.js using Feed for Node.js</generator>
<author>
<name>Daniel Roy Greenfeld</name>
Expand Down
2 changes: 1 addition & 1 deletion public/feeds/python.atom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<feed xmlns="http://www.w3.org/2005/Atom">
<id>https://daniel.feldroy.com/</id>
<title>Daniel Roy Greenfeld</title>
<updated>2024-06-04T13:23:23.831Z</updated>
<updated>2024-06-11T17:05:52.574Z</updated>
<generator>Next.js using Feed for Node.js</generator>
<author>
<name>Daniel Roy Greenfeld</name>
Expand Down
95 changes: 59 additions & 36 deletions public/feeds/til.atom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<feed xmlns="http://www.w3.org/2005/Atom">
<id>https://daniel.feldroy.com/</id>
<title>Daniel Roy Greenfeld</title>
<updated>2024-06-04T13:23:23.855Z</updated>
<updated>2024-06-11T17:05:52.603Z</updated>
<generator>Next.js using Feed for Node.js</generator>
<author>
<name>Daniel Roy Greenfeld</name>
Expand All @@ -14,6 +14,64 @@
<logo>https://daniel.feldroy.com/images/pydanny-cartwheel.png</logo>
<icon>https://daniel.feldroy.com/favicon.ico</icon>
<rights>All rights reserved 2024, Daniel Roy Greenfeld</rights>
<entry>
<title type="html"><![CDATA[TIL: Passing exceptions as arguments in Python]]></title>
<id>https://daniel.feldroy.com/posts/til-2024-06-passing-exceptions-as-arguments-in-python</id>
<link href="https://daniel.feldroy.com/posts/til-2024-06-passing-exceptions-as-arguments-in-python"/>
<updated>2024-06-07T10:13:05.553Z</updated>
<summary type="html"><![CDATA[Mypy needs an extra identifier to not choke on an exception passed as an argument.]]></summary>
<content type="html"><![CDATA[<p><em>Mypy needs an extra identifier to not choke on an exception passed as an argument.</em></p>
<p>This will throw a mypy error:</p>
<pre><code class="language-python"># code.py
class MyException(Exception):
pass
def myfunc(custom_exception: Exception) -> None:
try:
print('Test')
except custom_exception:
print('error)
myfunc(MyException)
</code></pre>
<p>The error mypy will throw looks something like this:</p>
<pre><code class="language-bash">$ mypy code.py
code.py:6: error: Exception type must be derived from BaseException (or be a tuple of exception classes) [misc]
code.py:9: error: Argument 1 to "custom_exception" has incompatible type "type[MyException]"; expected "Exception" [arg-type]
Found 2 errors in 1 file (checked 1 source file)
</code></pre>
<p>The solution is to use <code>typing.Type</code>:</p>
<pre><code class="language-python"># code.py
from typing import Type
class MyException(Exception):
pass
def myfunc(custom_exception: Type[Exception]) -> None:
try:
print('Test')
except custom_exception:
print('error)
myfunc(MyException)
</code></pre>
]]></content>
<author>
<name>Daniel Roy Greenfeld</name>
<email>[email protected]</email>
<uri>https://daniel.feldroy.com</uri>
</author>
<category term="TIL"/>
<contributor>
<name>Daniel Roy Greenfeld</name>
<email>[email protected]</email>
<uri>https://daniel.feldroy.com</uri>
</contributor>
</entry>
<entry>
<title type="html"><![CDATA[TIL: Renaming git branches]]></title>
<id>https://daniel.feldroy.com/posts/til-2024-06-renaming-git-branches</id>
Expand Down Expand Up @@ -50,39 +108,4 @@
<uri>https://daniel.feldroy.com</uri>
</contributor>
</entry>
<entry>
<title type="html"><![CDATA[TIL: Auto setup remote branch for git]]></title>
<id>https://daniel.feldroy.com/posts/til-2024-05-auto-setup-remote-branch-for-git</id>
<link href="https://daniel.feldroy.com/posts/til-2024-05-auto-setup-remote-branch-for-git"/>
<updated>2024-05-21T08:38:05.180Z</updated>
<summary type="html"><![CDATA[For getting rid of the "fatal: The current branch new-awesome-feature has no upstream branch" error.]]></summary>
<content type="html"><![CDATA[<p><em>For getting rid of the "fatal: The current branch new-awesome-feature has no upstream branch" error.</em></p>
<p>Whenever I create a new branch and try to push the new commit then I start seeing this error:</p>
<pre><code>git push --force
fatal: The current branch new-awesome-feature has no upstream branch.
To push the current branch and set the remote as upstream, use
git push --set-upstream origin new-awesome-feature
To have this happen automatically for branches without a tracking
upstream, see 'push.autoSetupRemote' in 'git help config'.
</code></pre>
<p>To fix it so git just auto creates the branch, just enter this magic command:</p>
<pre><code class="language-bash">git config --global --add --bool push.autoSetupRemote true
</code></pre>
]]></content>
<author>
<name>Daniel Roy Greenfeld</name>
<email>[email protected]</email>
<uri>https://daniel.feldroy.com</uri>
</author>
<category term="TIL"/>
<category term="git"/>
<category term="howto"/>
<contributor>
<name>Daniel Roy Greenfeld</name>
<email>[email protected]</email>
<uri>https://daniel.feldroy.com</uri>
</contributor>
</entry>
</feed>

0 comments on commit ee32b73

Please sign in to comment.