Seamless Proxy Auto-Config for CLI apps
Suppose you are in a corporate network environment and often times find yourself manually setting/unsetting the HTTP_PROXY
environment variable in order to access different hosts (for instance, "yay proxy" for the external hosts and "nay proxy" for the internal ones). Sounds familiar? In this case, a pure-Perl tool I've written might help you :)
Perl Weekly Challenge 015: Strong and Weak Primes, and Vigenère Cipher
Strong and Weak Primes
Write a script to generate first 10 strong and weak prime numbers.
The two sets of primes are defined with the following formulas:
- p(n) is Strong when
p(n) > [ p(n-1) + p(n+1) ] / 2
- p(n) is Weak when
p(n) < [ p(n-1) + p(n+1) ] / 2
It took me some time to realise there is a third set of primes which isn’t mentioned in the above list: there are also Balanced primes. The comparison operator for them is =
.
To generate primes, I reused the (slightly modified) module I created for the Challenge 012. It caches the primes found so far and extends their list when needed.
Perl Weekly Challenge # 15: Strong and Weak Primes and Vigenère Encryption
These are some answers to the Week 15 of the Perl Weekly Challenge organized by Mohammad S. Anwar.
Spoiler Alert: This weekly challenge deadline is due in several days from now (July 7, 2019). This blog post offers some solutions to this challenge, please don't read on if you intend to complete the challenge on your own.
Challenge # 1: Strong and Weak Prime Numbers
Write a script to generate first 10 strong and weak prime numbers.
Draw sin curve using Imager
Write sin curve using Imager.
Chart::GGPlot author say to me "It is hard to use graphic basic library for me".
so I want to illustrate basic drawing.
Cairo seems to be good as features but portability is not good.
so I try to plot sin curve by Imager.
Curve is continue of very short lines.
I wrote a graph of sin.
Performance is very fast. Generation of graph is in a second.

Monthly Report - June
Last month I was mostly involved with the "Perl Weekly Challenge". I didn't get any spare time to do anything else. Weekends were mostly busy with preparing weekly challenge. Then recap of every Perl5 solutions of previous week. It becomes even busier when I am working on Perl Weekly newsletter in that week. As the team growing, it is not going to be any easier. Luckily I have got help from Kian-Meng Ang who does the Perl5 code review every week.
We also started picking winner every week with the start of "Perl Weekly Challenge - 013" last month. We have had 2 winners so far, Laurent Rosenfeld and Jaldhar H. Vyas.
Let's take a quick look through last month main activities.
- Pull Request
- Git Commits
- Perl Weekly Challenge
- Pull Request Club
- Perl Blog
- PerlWeekly Newsletter
- Adopt CPAN Module
Pull Request
53 Pull Requests submitted in the month of June. With this I have now completed 50+ Pull Request every month so far in the year 2019, one of my new year resolutions.
As simple as possible...but no simpler
The first task of last week's Weekly Challenge
was to generate van Eck's sequence:
0, 0, 1, 0, 2, 0, 2, 2, 1, 6, 0, 5, 0, 2, 6, 5, 4, 0,...
The first challenge is to understand just what van Eck's sequence is,
as the various online explanations are less than instantly helpful.
Van Eck's sequence is a list of integers starting at zero, where the next number
in the sequence is given by the distance between the current number
and the nearest preceding occurrence of that same number.
For example, if the current number at index N (let's call it: Aₙ) is 7,
then to compute the number at index N+1 we look back through the
sequence for the most recent preceding occurrence of 7
(at some earlier index M). Then the next number in the sequence
is simply the distance between those two occurrences of 7.
Namely: N - M
SUSE Hackweek Day 4 - Fighting with XS and C
Perl Weekly Challenge #014
Challenge 1: Van Eck's sequence
I must admit I found the definition of the van Eck sequence hard to follow. The EXAMPLE at OEIS helped:
We start with a(1) = 0. 0 has not appeared before, so the rule says a(2) = 0. Now 0 HAS occurred before, at a(1), which is 1 term before, so a(3) = 1. 1 has not occurred before, so a(4) = 0. 0 appeared most recently at term a(2), which is 2 terms earlier, so a(5) = 2. 2 has not occurred before, so a(6) = 0. And so on.
Perl Weekly Challenge # 14: Van Eck's Sequence and US States
These are some answers to the Week 14 of the Perl Weekly Challenge organized by Mohammad S. Anwar.
Challenge # 1: Van Eck's Sequence
Write a script to generate Van Eck’s sequence starts with 0. For more information, please check out wikipedia page. This challenge was proposed by team member Andrezgz.
Jan Ritsema van Eck's sequence is an integer sequence defined recursively as follows. Let a(0) = 0. Then, for n ≥ 0, if there exists an m < n such that a(m) = a(n), take the largest such m and set a(n+1) = n − m; otherwise a(n+1) = 0. Thus, the first occurrence of an integer in the sequence is followed by a 0, and the second and subsequent occurrences are followed by the size of the gap between the two most recent occurrences.
This time, I'll start with Perl 6 (but complete the challenge in both P5 and P6).
Van Eck's Sequence in Perl 6
RPerl at the Perl Conference in Pittsburgh - Day 1
After the Texas Linux Fest, Team RPerl went all the way across the country to attend the 2019 North American Perl Conference. This time, I was not in charge of manning a booth. Instead, I was one of the official volunteers for the 3 days of the conference.
What does a volunteer do? He or she can work as a moderator, a runner, or a cameraman, depending on the needs of each talk. The moderator makes sure the speaker follows the schedule and has time for Q&A; the cameraman records the slides and films the speaker; while the runner is there in case something is needed, such as water for the speaker, more chairs, etc.
SUSE Hackweek Day 3 - (Not) Loading Objects in YAML::PP
Here's what I did on Thursday of the SUSE Hackweek.
Previous posts:
diff-so-fancy v1.2.6
diff-so-fancy strives to make your diffs human readable instead of machine readable. This helps improve code quality and helps you spot defects faster.
Version 1.2.6 of this perl utility has just been released.
Check it out here on github
Perl Weekly Challenge - Perl5 / Perl6
We are into the 14th week of Perl Weekly Challenge. If you look at participation of Perl5 and Perl6, based on data so far, we can clearly say Perl5 is the winner. However, I must clarify the race between the two is not objective of the Perl Weekly Challenge. But I see a pattern between the two. Perl6 solutions is always full of surprises where as Perl5 is just holding the ground. It could be because Perl5 is not new to me but anything and everything about Perl6 is new to me. Having said, some Perl5 solutions are full of surprises. I have become fan of some Perl5 contributors by the quality of code. I don't want to name just few. It would do injustice to others. Similarly there are some dedicated to Perl6 only and they are too good and great ambassador for Perl6. Damian Conway is one such who took the Perl Weekly challenge to another level.
Perl Weekly Challenge 014: Van Eck and the US States
This week, there was more work to be done for some of us: in addition to the standard three challenges, there was one more from Neil Bowers. His suggestion for a challenge had been simplified, so he published the original specification.
Van Eck’s Sequence
Let a0 = 0. Then, for n ≥ 0, if there exists an m < n such that am = an, take the largest such m and set an+1 = n − m; otherwise an+1 = 0.
I didn’t find a non-recursive formula for the sequence. I implemented a solution using an iterator: a subroutine that returns the next element of the sequence on each call.
Let’s start with a test.
SUSE Hackweek Day 2 - YAML::PP !include
In this post I'll talk about what I hacked on the second day of the SUSE hackweek. If you missed my other posts:
Why Perl 5 benefits is never talked in Perl Weekly Challenge?
Why Perl 5 benefits is never talked in Perl Weekly Challenge?
Simplicity made easy
The second task of last week's Weekly Challenge
was to list the dates of the last Friday in every month of a given year.
Many of the participants went to great lengths to create efficient and accurate solutions:
tracking the last day of each month, detecting leap years correctly,
working out formulas for the day of the month for a particular date,
managing the complex date arithmetic required.
But, given the powerful Date class built into Raku, most of those
admirable exertions were not actually necessary.
The entire task could be accomplished simply by walking through
from 1 January to 31 December of the given year, first checking
if each date is a Friday (i.e. the "day of the week" value is 5), and then
checking if the following Friday (i.e. the date exactly one week later)
happens to fall in a different month.
If both of those criteria are true, then we have a "last Friday of the month",
so we simply print it.
In other words:
Perl Weekly Challenge - Story so far ...
Originally posted on officially website, here I share the journey so far.
SUSE Hackweek Day 1 - Perl ♥ Bash
This week we had the SUSE Hackweek 18. It was my first Hackweek since I started working for SUSE. It happens about once or twice a year. People can contribute to any open source project they want to in that week.
So, thanks to SUSE for making this happen!
This blog post is about what I hacked on Tuesday, when Hackweek started for me. Expect more posts for the other days ;-)
About blogs.perl.org
blogs.perl.org is a common blogging platform for the Perl community. Written in Perl with a graphic design donated by Six Apart, Ltd.