Skip to content

Instantly share code, notes, and snippets.

View wo0dyn's full-sized avatar

Nicolas Dubois wo0dyn

View GitHub Profile
@wo0dyn
wo0dyn / groom-this-issue.py
Last active February 15, 2024 02:40
Snippet to generate a sentence with a random weight from the Fibonacci sequence (Linear)
import random
import rich
emojis = (
":nerd_face:",
":scream:",
":smile:",
":sunglasses:",
":thinking_face:",
@wo0dyn
wo0dyn / gist:3340763
Last active March 17, 2023 11:04
Write “KFC” with one-line-script using the string “Kentucky Fried Chicken” once.

KFC

Write KFC with one-line-script using the string “Kentucky Fried Chicken” once.

Bash

for w in $(echo "Kentucky Fried Chicken" | tr " " "\n"); do echo -n ${w:0:1}; done;
class Bee:
def __str__(self):
return "🐝"
class Dog:
def stepped_on(self, something):
...
if isinstance(something, Bee):
raise SystemExit("😱🥴")
def shortenize(words: str):
"""
>>> shortenize("Causses et Vallée de la Dordogne")
"Cauvaldor"
"""

In Computer Programming; 1 + 1 = …

class A(int):
    def __add__(self, value):
        return int(str(self) + str(value))
@wo0dyn
wo0dyn / earth_mars.py
Last active February 19, 2021 10:04 — forked from brunobord/earth_mars.py
What's the distance (in light-seconds and light-minutes) from Earth to Mars?
"""
Compute and display the Earth-Mars distance in light-seconds, light-minutes
and kilometers.
The easiest way is to install both ``skyfield`` & ``skyfield-data`` to compute
this:
$ pip install skyfield skyfield-data
You can also install `skyfield` only, but it'll force you to download the
@wo0dyn
wo0dyn / gist:4113739
Created November 19, 2012 20:41
GitHub HOW-TO “Resync a fork from original repo”

GitHub HOW-TO “Resync a fork from original repo”

I forked a repo dzen/omgcats a couple weeks ago on duboisnicolas/omgcats. I missed some commits so I need to resynchronize dzen/omgcats on duboisnicolas/omgcats.

$ git clone git://github.com/duboisnicolas/omgcats.git
$ cd omgcats 
# New branch for latest commits:
$ git checkout -b upstream/master
# Add new remote upstream from original repo:

Math Puzzle

One possible solution: brute force

import collections
import itertools
@wo0dyn
wo0dyn / exercise.md
Created July 26, 2014 16:42
Find a 9 letter string of characters that contains only letters from “acdegilmnoprstuw” such that the hash(the_string) is “910897038977002”.

Find a 9 letter string of characters that contains only letters from

acdegilmnoprstuw

such that the hash(the_string) is

910897038977002