Skip to content

Instantly share code, notes, and snippets.

View ffedoroff's full-sized avatar
🏠
Working from home

ffedoroff

🏠
Working from home
View GitHub Profile
@ffedoroff
ffedoroff / RaspberryPi-HC-SR04.py
Last active December 21, 2015 08:28
Raspberry Pi HC-SR04 Module ( view demo on http://youtu.be/etWD_-KDLnA )
# Module: ultrasound.py
# This module can be used to operate an HC-SR04 ultrasonic sensor
# from a raspberry pi GPIO.
import time
import RPi.GPIO as GPIO
# setup which pins are which
TRIG = 8
ECHO = 7
@ffedoroff
ffedoroff / gist:5598450
Last active December 17, 2015 10:58
png recolor
<?php
function resizeImage($img, $new_color, $color_range) {
list($width_orig, $height_orig) = getimagesize($img);
$src = imagecreatefrompng($img);
$dst = imagecreatetruecolor($width_orig+50,$height_orig+50);
$pink = imagecolorallocate($dst, 255, 105, 180);
imagefilledrectangle($dst, 15, 50, 150, 150, $pink);
$size_arr = getimagesize($img);
for ($y=0; $y<$size_arr[1]; $y++) {
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from raven import Client
client = Client('https://c0615656d179475ba9fc93e60ca3af60:[email protected]:446/2')
# record a simple message
client.captureMessage("hello world from roma с переводом строк\nеще и по русски и очень длинный текст \nи очень длинный текст и очень длинный текст и очень длинный текст и очень длинный текст и очень длинный текст\n ыфвафывафыавфыа")