Skip to content

Instantly share code, notes, and snippets.

View lazywithclass's full-sized avatar

Alberto Zaccagni lazywithclass

View GitHub Profile
lazywithclass / winston-cloudwatch-type-definition.d.ts
Last active December 4, 2018 20:22
import * as winston from 'winston';
import * as Transport from 'winston-transport';
import { CloudWatch, CloudWatchLogs } from 'aws-sdk';
export namespace WinstonCloudWatch {
export type LogObject = {level: string, msg: string, meta?: any};
export interface CloudWatchIntegration {
lazywithclass /
Last active February 21, 2022 21:39
Bandwidth throttling on FreeBSD

Bandwidth throttling on FreeBSD

Installing FreeBSD in VirtualBox will help a lot, I've also set

  • PasswordAuthentication yes
  • PermitRootLogin yes

followed by a /etc/rc.d/sshd restart to allow root to login from my tmux environment on the host box. Make sure you have sshd installed and running on the virtual image. This way I could have multiple tmux panes and copy / paste working (which wasn't in my case).

lazywithclass /
Created February 9, 2018 08:36
One year after RC and plans
lazywithclass /
Last active January 9, 2018 22:02
[Teaching programming] Lesson six

[Teaching programming] Lesson six

(define insert-middle
  (lambda (new lat)
    (cons (car lat) (cons new (cdr lat)))))

We've been experimenting with functions, so we're starting to move away from the list manipulation tasks for their own sake.

lazywithclass /
Last active November 30, 2017 09:25
[Teaching programming] Lesson five

[Teaching programming] Lesson five - lazyblog


When everything works and good definitions and examples just flow naturally and the other person seems to be learning everything you're saying.

I don't have anything particular to say, except the fact that the work from the previous weeks seems to be paying off, over all giving her a method improved dramatically the way she deals with implementing functions from scratch. Also, doing exercises as we go in the book it's way more effective than having her solve them on her own.

lazywithclass /
Last active November 20, 2017 18:22
[Teaching programming] Lesson four

[Teaching programming] Lesson four - lazyblog

On exercises

They are way too difficult. I've slowed the pace considerably due to a misjudgement of exercises difficulty.

On giving a method

It was her who raised this point and it actually makes a lot of sense, it's a shame I didn't think about this earlier on.

lazywithclass /
Created November 6, 2017 11:20
Simulate work in a directory adding and updating files
while true; do
filename=$(((RANDOM %10) + 1))
if [ -f $filename ]; then
mkfile 30m data/$filename
randomstring=$(LC_CTYPE=C tr -dc A-Za-z0-9 < /dev/urandom | fold -w ${1:-$(((RANDOM %1000000) +1))} | head -n 1)
echo $randomstring >>data/$filename
lazywithclass /
Created November 6, 2017 10:26
[Teaching programming] Lesson three

[Teaching programming] Lesson three - lazyblog


There was some confusion on how to use functions and recursion in the end. I didn't spot that previously. I am starting to think that a lot of what "being a teacher" means is to understand when your audience got the idea you're trying to pass on.

So what didn't I understand? For sure the fact that going from
### ctags
### global
lazywithclass / exercises.scm
Last active October 27, 2017 09:28
Exercises after The Little Schemer chapter 2 (2)
;; in the previous solution we implemented 2nd and last
;; but we did not define proper return values for the edge cases,
;; this time we will
;; your task will be to provide those values, as you can imagine
;; (sum 4 'gatto) does not have an answer
;; make it so that expressions will return true
;; a suggestion would be to paste the definitions of 2nd and last
;; above the exercises and fix the errors you get, by returning proper values