Skip to content

Instantly share code, notes, and snippets.

View chapuzzo's full-sized avatar
👾
blip blip blup blip blup

chapuzzo

👾
blip blip blup blip blup
View GitHub Profile
#!/usr/bin/env ruby
file = ARGV.shift
contents = File.read(file, {:encoding => "ISO-8859-15", :mode => "rb"})
contents.encode!("UTF-8")
File.open(file, 'w') do |f|
f.write(contents)
@chapuzzo
chapuzzo / bling.js
Last active August 29, 2015 14:23 — forked from paulirish/bling.js
/* bling.js */
window.$ = document.querySelectorAll.bind(document)
Node.prototype.on = window.on = function (name, fn) {
this.addEventListener(name, fn)
}
NodeList.prototype.__proto__ = Array.prototype
@chapuzzo
chapuzzo / example.js
Created July 17, 2019 11:03
Paso de valores entre dos módulos de javascript
import { config, editName, getConfig, getName, updateConfig, editSetting, getSetting } from './options'
// con objetos
console.log(getConfig())
config.angle = 45
console.log(getConfig())
// con funciones que manipulan objetos
console.log(getConfig())
updateConfig({
@chapuzzo
chapuzzo / .babelrc
Last active July 17, 2019 11:31
Paso de valores entre dos módulos de javascript
{
"presets": [
[
"@babel/preset-env",
{
"targets": {
"node": "current"
}
}
]
source "https://rubygems.org"
gem 'awesome_print'
gem 'pry'
@chapuzzo
chapuzzo / send_dataframe_as_csv.py
Last active July 14, 2020 11:38
in memory dataframe to binary blob (eg. flask)
from io import BytesIO, StringIO
import pandas as pd
from flask import send_file, Flask
server = Flask(__name__)
@server.route("/download/", defaults=dict(name="file"))
@server.route("/download/<name>")
@chapuzzo
chapuzzo / FanLightToggleTest.ino
Created August 13, 2021 07:10
Tinkering with ventiators and IR signals
/*
* Fan protocol tester
* light should toggle
*/
#include <Arduino.h>
/*
* Set library modifiers first to set output pin etc.
*/
fila = 1
while fila <= 5:
i = 1
while i <= fila:
print('*', end='')
i += 1
print()
fila += 1
@chapuzzo
chapuzzo / dw.rs
Created December 1, 2022 19:27
Little tool to download samples/inputs for AoC
use clap::Parser;
use reqwest::Client;
use select::predicate::{Name, Predicate};
use std::env;
use std::fs::{create_dir_all, File};
use std::io::Write;
use std::path::Path;
use std::time::Duration;
#[derive(PartialEq)]