Skip to content

Instantly share code, notes, and snippets.

const sharp = require('sharp');
const path = require('path');
if(process.argv.length < 3) {
console.log('You must provide an image as a cmd-line argument!');
process.exit(-1);
}
sharp(process.argv[2]).toFile(''+ process.argv[2].slice(0, process.argv[2].indexOf('.'))+'.jpg');
console.log('Done!');
import sys
sys.dont_write_bytecode = True # avoid corruptions
import serial
import time as t
import os.path
import ssl
import RPi.GPIO as gpio
import lcd_driver as lcd
import threading as thr
import pychromecast as pych
app.get('/get_data', (req, res, next) => {
BMP180.fetch( (err, data) => {
if(err) {
console.error("An error on reading the BMP180 occured!");
console.error(err.cause);
}
if(data.type === 'Temperature')
temp = data.value.toFixed(1);
if(data.type === 'Pressure')
press = (data.value / 100).toFixed(2);
/*!
* @license Open source under BSD 2-clause (http://choosealicense.com/licenses/bsd-2-clause/)
* Copyright (c) 2015, Curtis Bratton
* All rights reserved.
*
* Liquid Fill Gauge v1.1
*/
function liquidFillGaugeDefaultSettings(){
return {
minValue: 0, // The gauge minimum value.
const colors = require('colors/safe');
// 6-sided dice
var min = 1,
max = 6,
first = roll(min, max),
second = roll(min, max);
console.log("Dice 1:", first);
console.log("Dice 2:", second);
console.log(colors.cyan(colors.bold("Tot: " + (first + second))));
@RcrdBrt
RcrdBrt / nginx.conf
Created November 23, 2016 12:37 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
/*
* elevator really-noop
*/
#include <linux/blkdev.h>
#include <linux/elevator.h>
#include <linux/bio.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/init.h>
#include <c8051f020.h>
int c=0;
int d=0;
bit event=0;//1= è avvenuto un interrupt;
bit a=1;
bit toverflow=0;
bit secondevent= 0; // seconda pressione
sbit Button = P3^7;
sbit Led = P1^6;
@RcrdBrt
RcrdBrt / compile-nginx.sh
Created May 23, 2017 07:24 — forked from JoeUX/compile-nginx.sh
Optimized nginx compilation flags for modern CPUs, faster math, and LTO. This should be much faster than vanilla nginx builds. Still testing.
# Install dependencies
#
# * checkinstall: package the .deb
# * libpcre3, libpcre3-dev: required for HTTP rewrite module
# * zlib1g zlib1g-dbg zlib1g-dev: required for HTTP gzip module
apt-get install checkinstall libpcre3 libpcre3-dev zlib1g zlib1g-dbg zlib1g-dev && \
mkdir -p ~/sources/ && \
# Compile against OpenSSL to enable NPN. I updated this block to get the latest 1.0.2h release. It's critical that OpenSSL be up to date.
# Maintainer: Miguel de Val-Borro <miguel at archlinux dot net>
pkgname=('python-django-bootstrap3' 'python2-django-bootstrap3')
pkgver=9.0.0
pkgrel=1
pkgdesc="Bootstrap 3 integration with Django"
arch=('any')
url="http://github.com/dyve/django-bootstrap3"
license=('Apache')
makedepends=('python' 'python-setuptools' 'python2' 'python2-setuptools')