Git Product home page Git Product logo

code-maven.com's Introduction

This is the source code of the Code-Maven site: https://code-maven.com

Copyright and License

Copyright by Gabor Szabo https://szabgab.com, 2023. All Rights Reserved.

TRANSCRIPTIONS of the podcasts

The CMOS podcasts (listed here https://code-maven.com/cmos ) have a transcription.

The format of the transcription looks like this:

<transcript>
  <szabgab host1 Gabor Szabo>
  <foobar guest1 Foo Bar>

  <entry 0:00 szabgab>
    Hello!
  </entry>

  <entry 0:25 foobar>
  </entry>

  ....

</transcript>

Everything is within the <transcription></transcription> tags. At the beginning we declare the participants:

<szabgab host1 Gabor Szabo> declares that the nickname 'szabgab' is used for the host whose real name is 'Gabor Szabo.' <foobar guest1 Foo Bar> declares that the nickname 'foobar' is used for the guest, whose real name is 'Foo Bar.'

Then every time the speaker switches we have an <entry></entry> and within that entry we have the text the person said. When another person starts to speak we create a new <entry></entry> section.

In the opening of each <entry> we write the timestamp of when it starts in the podcast and then the nickname of the person who speaks.

Convert Jupyter notebooks:

ipython nbconvert --to html ../kaggle-NoShowAppointments/No-show_unbalanced_data.ipynb
mv ../kaggle-NoShowAppointments/No-show_unbalanced_data.html static/html/no-show-unbalanced-data.html

Then create a regular article that links to that page.

code-maven.com's People

Contributors

allister-db avatar bert42 avatar chsanch avatar cm-demo avatar crossan007 avatar davidkaufman avatar davidventasmarin avatar ferki avatar fractallotus avatar jberger avatar jkva avatar kuutio-hub avatar lonerambler avatar maxnis avatar mayursmahajan avatar mazlman avatar mlriain avatar name2rnd avatar niceperl avatar oalders avatar peterdragon avatar ronstrauss avatar sebastienbinet avatar sh770 avatar shlomif avatar szabgab avatar tedgonzalez avatar yaelsz avatar zarabozo avatar zero-pytagoras avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

code-maven.com's Issues

Comment on Jinja post: `pathlib` example

https://code-maven.com/minimal-example-generating-html-with-python-jinja
Thanks for your amazing jinja example.
One suggestion: The first example could be simlified a bit with pathlib

from jinja2 import Environment, FileSystemLoader
from pathlib import Path
 
root =  Path.cwd()
templates_dir = root /'templates'
env = Environment( loader = FileSystemLoader(templates_dir) )
template = env.get_template('index.html')
filename = root / "rendered_index.html"

with open(filename, 'w') as fh:
    fh.write(template.render(
        h1 = "Hello Jinja2",
        show_one = True,
        show_two = False,
        names    = ["Foo", "Bar", "Qux"],
    ))

Report failed stage name not working with parallel stages

Hi there,

Reporting failed stage in the post section is quite a handy trick. Thanks for that!
However I struggle to make it work in a more complex scenario using parallel stages. Let's consider this:

pipeline {
    agent none // Using 2 different slaves
    stages {
        stage('For parallel stuff') {
            failFast true
            parallel {
                stage('Slave A with sequential stages') {
                    agent  { node { label "os-linux" } }
                    stages {
                        stage ('Stuff 1 on slave A') {
                            steps {
                                script {
                                    last_started = env.STAGE_NAME
                                    // stuff
                                }
                            }
                        }
                        stage ('Stuff 2 on slave A') { ... }
                        stage ('Stuff 3 on slave A') { ... }
                    }
                }
                stage('Slave B with sequential stages') {
                    agent  { node { label "os-windows" } }
                    stages {
                        stage ('Stuff 1 on slave B') {
                            steps {
                                script {
                                    last_started = env.STAGE_NAME
                                    // stuff
                                }
                            }
                        }
                        stage ('Stuff 2 on slave B') { ... }
                        stage ('Stuff 3 on slave B') { ... }
                    }
                }
            }
        }
    }
    post { // Using STAGE_NAME variable }
}

If, for example, "Stuff 2 on slave B" started after "Stuff 1 on slave A", although that the later one fails, the first one is reported.

Then people throw rocks at you beause you reported the wrong failed stage ... :(

Some ideas on how to handle that?
How come Jenkins pipeline UI or Blue Ocean manage to get the right one that failed?

Cheers,

Edouard

Adding new fonts

Hi sir @szabgab, I see a code of how to write a text in pdf using python here https://code-maven.com/creating-pdf-files-using-python. my concern is this

from reportlab.pdfgen import canvas
 
pdf_file = 'hello_world_fonts.pdf'
 
can = canvas.Canvas(pdf_file)
 
print(can.getAvailableFonts())
# 'Courier', 'Courier-Bold', 'Courier-BoldOblique', 'Courier-Oblique',
# 'Helvetica', 'Helvetica-Bold', 'Helvetica-BoldOblique', 'Helvetica-Oblique',
# 'Symbol',
# 'Times-Bold', 'Times-BoldItalic', 'Times-Italic', 'Times-Roman',
# 'ZapfDingbats'
 
can.setFont("Helvetica", 24)
can.drawString(20, 400, "Hello")
can.drawString(40, 360, "World")
 
can.setFont("Courier", 16)
can.drawString(60, 300, "How are you?")
 
can.showPage()
can.save()

How can I add a font on the list? like Cambria.
thank you

Regex Speed Comparison Updates

https://code-maven.com/compare-the-speed-of-grep-with-python-regex

I'm unsure why/how the python example was so slow in this testing. When I verbatim tested these scripts (and your sample a.txt file), I got that bash was completing in 0.27 s and that Python3 (version 3.8.9) was completing in 1.71 seconds. I was no where near the 9+ seconds specified in your example, and I tested this on multiple machines.

If I pre-compiled the Python regex pattern (pattern = re.compile(r'y')), then the performance dramatically improves to 0.5 seconds.

2 other interesting cases (which might be more applicable to Perl/Python comparison):

  1. The Python was eventually faster than the Perl script with larger files and pattern matches (a file of 1,000,000 lines and 1,000 characters per line)
  2. Perl showed significant performance differences based on how the regex pattern was defined. A hardcoded regex pattern ($line =~ /y/) was slightly faster than using a pattern stored as a scalar variable ($line =~ /\Q$pattern\E/). These were both way faster than getting the pattern from an array. I created a single-element array with the element being 'y', the script took over TWICE as long to complete as with the scalar variable.

readfile-writefile.txt in Jenkins

Hi Gabor,

Regarding the Jenkins readfile and writefile , I have a doubt here as By using the script we were able to read the data from a text file and able to print the same , But How can we Pass the values in for Loop and print them in a for loop , I have tried different values but those are printing the values all at a time not according to the loop.

Any suggestions on this is highly appreciated.

embed cmd into a gui app?

I am writing a project that is CLI driven. Some gui components could be useful. Are you aware of a method to embed the cmd object into a gui frame? I could launch seperate gui objects outside of the cli, but that is a little sloppy, as it wont be a unified interface.

Thank you.

Episode date format invalid / Invalid feed.

Not sure if this is the right place to contact you but I'm trying to submit your podcast feed http://code-maven.com/rss/cmos to: http://www.pocketcasts.com/submit

I get the following errors:

Episode date format invalid.
Solution: Change the pubDate tag to use the following format:
<pubDate>Wed, 03 Nov 2015 19:18:00 GMT</pubDate>

Invalid feed
Your podcast doesn’t seem to contain any episode files. Try adding an episode under the enclosure URL tag, eg:
<enclosure url="http://example.com/podcast/episode1.mp3" length="5860687” type=“audio/mpeg"/>

Really enjoying the podcast but I would like to subscribe with Pocket Casts so I don't miss an episode.

More basic examples of Groovy Maps

Hey Gabor:

On your map page: https://code-maven.com/groovy-map you jump immediately into a map which has an array value. Unless I'm missing a more simple page previously, I would think that starting with simpler name/value pairs would be more helpful. You could then talk about name -> arrays in more complex maps page or just further down the page.

Thanks much.

How to use map in jenkinsfile ?

I write code in jenkinsfile

pipeline{
   
   agent { label "docker-slave2" }
   
   options {
       timestamps()
   }  
   
   stages {
       
       stage('parallel stage'){
           steps {
             script {
                def nodejsmap = [ "/home/tcl/customer": "sales-customer-ui-prod", "/home/tcl/platform": "sales-platform-ui-prod"  ]
                for  (element in nodejsmap) {
                      stage('Preparation') {
                       sh 'printenv'
                       cleanWs()
                       git branch: "${env.gitlabBranch}", credentialsId: "12345678", url: "http://172.16.200.112:8000/${element.value}.git"
                       }

                       stage('Build') {
                          nodejs('nodejs_16.16') {
                          sh 'npm install --location=global yarn'
                          sh 'yarn install'
                          sh 'rm -f package-lock.json'
                          sh 'npm run build:dev'
                          sh 'tar -zcvf dist/dist.tar dist/*' 
                          }
                        }

When I run this jenkinsfile , it report this error :

an exception which occurred:
	in field com.cloudbees.groovy.cps.impl.ForInLoopBlock$ContinuationImpl.itr
	in object com.cloudbees.groovy.cps.impl.ForInLoopBlock$ContinuationImpl@4d9df4d9
	in field com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.target
	in object com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl@1af3614
	in field com.cloudbees.groovy.cps.impl.SequenceBlock$ContinuationImpl.k
	in object com.cloudbees.groovy.cps.impl.SequenceBlock$ContinuationImpl@1cbb7b70

Caused: java.io.NotSerializableException: java.util.LinkedHashMap$LinkedEntryIterator
	at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:926)
	at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1082)
	at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1040)
	at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:920)
	at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1082)
	at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1040)
	at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:920)
	at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1082)

How to solve the above problem ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.