Skip to content

Instantly share code, notes, and snippets.

View pietroppeter's full-sized avatar
🐳
chasing the whale

Pietro Peterlongo pietroppeter

🐳
chasing the whale
View GitHub Profile
@pietroppeter
pietroppeter / packages_count.csv
Last active April 7, 2020 16:47
Time series of count of Nimble packages
commit timestamp error count
46d6a99185845ef0e9081f8c15f4df9ac8208253 2020-04-06 17:51:19 +0200 0 1244
6e34b7d3e1855ea98eb8b7dac12daee6e345f14e 2020-04-05 19:59:42 +0200 0 1243
32d0a1cc0a126bf5dbd5fc7a74df27558cf6a1a5 2020-04-02 06:53:08 +0200 0 1238
382aa3308f634cf4dc240bdba0beb1ce7d6bbc5d 2020-03-30 10:43:43 +0200 0 1237
686f78da0924af9afea4cb58616aef8c377d7781 2020-03-30 08:59:42 +0200 0 1237
0d11b7a59a22c0b6effd588be8ed8f55a3995758 2020-03-30 08:07:20 +0200 0 1236
fb54af4ca0b906a15c72e7c1c540ec4f931d09f7 2020-03-29 18:49:47 +0200 0 1235
261020cc3cc89198cc97f21f1a3c0b278eddd27e 2020-03-28 07:09:40 +0100 0 1234
4ecdc0c116f1d1aa89f1dd1d8e35e8c04cdcd221 2020-03-27 18:42:32 +0100 0 1233
@pietroppeter
pietroppeter / nimble-packages-count.vl.json
Last active April 7, 2020 16:58
Vegalite spec for displaying count of Vegalite packages in linear and log scale
{
"$schema": "https://vega.github.io/schema/vega-lite/v4.json",
"title": "Number of Nimble packages",
"data": {"url": "https://gist.githubusercontent.com/pietroppeter/b7cbd29c2a1c4db443712396c34201e8/raw/cd0b5a4a0446cf87b851f3c9353b273cbd8f06c3/packages_count.csv", "format":{"type":"csv"}},
"transform": [
{"calculate": "timeFormat(datum.timestamp, '%Y-%m-%d')", "as": "date"},
{"filter": "datum.error == 0"}
],
"width": 800,
"height": 500,
@pietroppeter
pietroppeter / package_count.nim
Last active April 7, 2021 16:10
Nim file to count Nimble packages
# git clone https://github.com/nim-lang/packages.git
# then compile and run this file in the git repo
import os, parsecsv, json, strutils
proc runCommand(command: string) =
let errorCode = os.execShellCmd(command)
if errorCode != 0:
echo "error running command: " & command
quit(1)
else:
@pietroppeter
pietroppeter / week.nim
Created September 10, 2020 12:36
isoweek number in nim
## iso week number
## see https://en.wikipedia.org/wiki/ISO_week_date#Calculating_the_week_number_of_a_given_date
import times
type
WeekRange = range[1 .. 53]
proc lastWeek(year: int): WeekRange =
## The long years, with 53 weeks in them, can be described as any year starting on Thursday and any leap year starting on Wednesday
let firstWeekDay = initDateTime(1.MonthDayRange, mJan, year, 0, 0, 0).weekday
@pietroppeter
pietroppeter / hello_world.html
Created October 22, 2020 19:51
nimib preview
<!DOCTYPE html>
<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="content-type">
<title>world.nim</title>
<meta content="width=device-width, initial-scale=1" name="viewport">
<link rel='stylesheet' href='https://unpkg.com/normalize.css/' type='text/css'>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/kognise/water.css@latest/dist/light.min.css">
</head>
<body>
@pietroppeter
pietroppeter / cairo_deps.md
Last active February 15, 2021 15:46
Cairo dependencies for Windows (to use ggplotnim on Windows)

A common issue while trying to use https://github.com/Vindaar/ggplotnim on Windows is the fact that it is not easy to satisfy the full list of dll for Cairo.

In an issue (Vindaar/ggplotnim#57) and related gist (https://gist.github.com/Vindaar/6cb4e93baff3e1ab88a7ab7ed1ae5686) one of the best options seems to be to install emacs and add its bin folder to the path.

Using a dll dependency analyzer (https://github.com/lucasg/Dependencies, found through SO: https://stackoverflow.com/questions/7378959/how-to-check-for-dll-dependency), I was able to list all the dlls required, which are the following 17 files (including libcairo-2.dll, total around 9MB).

So another solution instead of installing emacs is to download the dlls (see link to libcairo-deps.rar in comment) and copy them in ~\.nimble\bin.

List of all recursive dependencies for libcairo-2.dll:

  • libbz2-1.dll
sudo apt-get update
sudo apt-get install libpangocairo-1.0-0
sudo apt-get install libblas-dev liblapack-dev
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@pietroppeter
pietroppeter / add.nim
Created September 8, 2022 12:45
dll analysis in nim
# compile with: nim c --app:lib -d:release add.nim
# examine with: peni info -a add.dll
# see https://forum.nim-lang.org/t/9446
proc add*(num1, num2: int): int {.stdcall, exportc, dynlib.} =
num1 + num2
@pietroppeter
pietroppeter / languages-and-vms.md
Created November 11, 2022 13:13 — forked from haxscramper/languages-and-vms.md
languages-and-vms