Skip to content

Instantly share code, notes, and snippets.

@ilmanzo
ilmanzo / gen.d
Last active March 11, 2024 16:14
module gen;
import mustache;
import std.stdio;
import std.json;
import std.array;
import painlessjson;
class TestSuite
{
format = """
[ ](bg:#73ba25)\
[▓▒░](#73ba25)\
[  ](fg:#73ba25 bg:#090c0c)\
$directory\
$git_branch\
$git_status\
\n$character"""
[character]
package main
import "fmt"
func main() {
fmt.Println("hello world!")
}
@ilmanzo
ilmanzo / aoc_2021_day1.nim
Last active December 1, 2021 14:31
Advent of Code 2021: day1 solution in Nim
import std/strutils
import std/sequtils
proc count_increases(items : seq[int]) : int =
for i in 1 .. items.high:
if items[i] > items[i - 1]:
inc result
proc get_sums(items: seq[int]) : seq[int] =
for i in countup(2,items.len-1):
@ilmanzo
ilmanzo / ssh_client_example.go
Last active May 17, 2024 23:16
example for ssh client in Go with username and password authentication
package main
import (
"bytes"
"fmt"
"log"
"golang.org/x/crypto/ssh"
)
func main() {
module main
struct List {
head &Node
name string
}
struct Node {
mut: data int
next &Node
@ilmanzo
ilmanzo / main.py
Last active December 19, 2019 16:45
scheletro per AstroPi "life in space" con display spinner integrato
import ephem
from math import radians, degrees, cos, sin, asin, sqrt
from sense_hat import SenseHat
import time
import math
import os
import datetime
from time import sleep,strftime
import logging
import logzero
@ilmanzo
ilmanzo / spinner.py
Last active October 27, 2019 16:44
classe "spinner" per AstroPi SenseHat
from sense_hat import SenseHat
import time
import math
sensehat = SenseHat()
sensehat.low_light = True
class Spinner():
def __init__(self,sensehat):
; setup
;
; sudo apt-get install cmatrix nasm ; nasm -f elf64 -o matrix.o matrix.asm ; ld -o matrix matrix.o; ./matrix
SECTION .text
global _start
_start:
mov rdx, environment ; address of environment variables
@ilmanzo
ilmanzo / gist:fcba47b0b79d4cb1e1768d688a6992a8
Last active January 30, 2018 12:39
prova testo due colonne
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8"></meta>
<meta
name="viewport"
content="width=device-width, initial-scale=1, shrink-to-fit=no"
></meta>