Skip to content

Instantly share code, notes, and snippets.

View perlmonk's full-sized avatar

perlmonk perlmonk

View GitHub Profile
@perlmonk
perlmonk / fan.py
Last active December 17, 2017 03:49
Raspiberry Pi fan control by GPIO(with modification add cooling temperature range)
#!/usr/bin/env python3
# Author: Edoardo Paolo Scalafiotti <edoardo849@gmail.com>
# https://hackernoon.com/how-to-control-a-fan-to-cool-the-cpu-of-your-raspberrypi-3313b6e7f92c
import os
from time import sleep
import signal
import sys
import RPi.GPIO as GPIO
pin = 18 # The pin ID, edit here to change it
maxTMP = 46 # The maximum temperature in Celsius after which we trigger the fan
@perlmonk
perlmonk / libtool.pl
Created February 3, 2016 13:16
compile openssl on osx 10.11
#!/usr/bin/perl
=pod
I have GNU libtool installed so the answer from link below not simply work:
http://stackoverflow.com/a/30970680/3368344
The `ar` command like `ar r ../libcrypto.a cryptlib.o mem.o ...`
This script remove `r` from arguments, and call osx libtool to merge o files to a file.
@perlmonk
perlmonk / lrpreview2jpg.pl
Last active December 6, 2015 10:53
Recover Images from Lightroom Previews, inspired by http://photo.bragit.com/Lightroom/articles/RecoverFromPreview.shtml
#!/usr/bin/perl
# 从lrprev里截取图片
use strict;
use warnings;
# single file
my $file = '/path/to/Lightroom x Catalog Previews.lrdata/x/x/id.lrprev';
my $dest = '/path/to/jpeg/prefix';
convert($file, $dest);
@perlmonk
perlmonk / form_test.cpp
Last active August 29, 2015 14:14
test curl 'curl_formadd' submit array field
// http://curl.haxx.se/libcurl/c/postit2.html
#include <stdio.h>
#include <string.h>
#include <curl/curl.h>
int main(int argc, char *argv[])
{
CURL *curl;
CURLcode res;