Skip to content

Instantly share code, notes, and snippets.

View nico202's full-sized avatar

Nicolò Balzarotti nico202

View GitHub Profile
@nico202
nico202 / build.py
Last active November 13, 2019 19:39
Includes external resources in html files. Use with: python build.py input.html output.html (adapted from https://stackoverflow.com/questions/28258579/modify-html-file-to-embed-all-external-scripts-and-css-into-script-and-style)
# This takes an html, looks for script and stylesheet tags,
# download them (when necessary) and then
import sys, re, os
from collections import deque
from bs4 import BeautifulSoup, Tag
from jsmin import jsmin
from cssmin import cssmin
from urllib.parse import urlparse
import requests
@nico202
nico202 / statcheck-cli
Last active February 20, 2019 09:30
statcheck command line interface
# License is GPLv2+
#!/usr/bin/env Rscript
library(statcheck)
library(stringr)
args <- commandArgs(trailingOnly=TRUE)
if (length(args)==0) {
stop("Usage: statcheck-cli filename.txt", call.=FALSE)
} else if (length(args)==1) {
@nico202
nico202 / check-determinism.sh
Last active October 30, 2018 15:28
Test julia precompilation determinism
#!/usr/bin/env bash
n=$(pwd)
# The folder must be named always the same way
# Since the path is included in the .ji files
d=/tmp/my-julia-tmp-dir
mkdir -p $d
cd $d
HOME=$(realpath .) \julia --startup-file=no -q --depwarn=no -e 'using Pkg; Pkg.add("Lazy"); using Lazy'
;;; org-chef-giallozafferano.el --- org-chef giallozafferano fetching. -*- lexical-binding: t; -*-
;; Copyright (C) 2018 Nicolò Balzarotti
;; Author: Nicolò Balzarotti <nicolo@nixo.xyz>
;; URL: https://github.com/Chobbes/org-chef
;; Created: 2018
;; Copyright 2018 Nicolò Balzarotti
@nico202
nico202 / clone_all_packages.sh
Created February 21, 2018 10:50
julia packages -> nixpkgs
wd='julia-nix-workdir'
mkdir -p $wd
cd $wd
git clone --depth=1 git@github.com:JuliaLang/METADATA.jl.git
while read url; do
git clone --depth=1 $url
done < $(find ./METADATA.jl/ -name url -exec cat '{}' \; -exec echo \; |sort -u)
;; [[elfeed:pragmaticemacs.com#http://pragmaticemacs.com/?p=752][A workflow to quickly add photos to org-mode notes]]
;; use case is taking a photo of a slide in a conference and uploading
;; it to syncthing and get it on your computer. You then want to embed
;; it in an org-mode document by moving it to the subfolder and
;; renaming according to the current section of the org file, avoiding
;; name clashes
;; required libraries
(require 'dash)
(require 'swiper)
with import <nixpkgs> {};
{
repositoryName = stdenv.mkDerivation {
name = "repositoryName";
buildInputs = [
julia_05 # works with julia (v0.4) too
# Any other dependency you need
];
SSL_CERT_FILE="/etc/ssl/certs/ca-certificates.crt";
@nico202
nico202 / backtrace
Created January 31, 2017 12:53
26-video backtrace with .alsoftrc
Thread 1 "26-video" received signal SIGSEGV, Segmentation fault.
0x000000000051d690 in OpenAL_AudioInterface::update(float) ()
(gdb) bt full
#0 0x000000000051d690 in OpenAL_AudioInterface::update(float) ()
No symbol table info available.
#1 0x00000000005200e6 in TheoraVideoManager::update(float) ()
No symbol table info available.
#2 0x00000000004b73d7 in chai3d::cVideo::update() ()
No symbol table info available.
#3 0x00000000004b749f in chai3d::cVideo::getCurrentFramePointer(chai3d::cImage&) ()
@nico202
nico202 / shell.nix
Created October 12, 2016 07:38
julia git missing llvm
with import <nixpkgs> {}; {
env = stdenv.mkDerivation {
name = "0.5";
buildInputs = [
julia-git
];
shellHook = ''
unset http_proxy
export SSL_CERT_FILE=/etc/ssl/certs/ca-bundle.crt
@nico202
nico202 / gazebo-config.cmake
Created September 26, 2016 16:23
Gazebo broken cmake
if (GAZEBO_CONFIG_INCLUDED)
return()
endif()
set(GAZEBO_CONFIG_INCLUDED TRUE)
set(GAZEBO_VERSION 7.0)
set(GAZEBO_MAJOR_VERSION 7)
set(GAZEBO_PLUGIN_PATH "/nix/store/azqhm87lhpm487459ijna60hih184pfy-gazebo-7.0.0//nix/store/azqhm87lhpm487459ijna60hih184pfy-gazebo-7.0.0/lib/gazebo-7/plugins")
# The media path contains the location on disk where images,