View CropImage.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from PIL import Image, ImageDraw | |
def checkX(image, x): | |
pixels = image.load() | |
sum = 0; | |
for i in range(image.size[1]): | |
if (pixels[x,i][3] == 0): | |
sum += 1 | |
return (sum == image.size[1]) |
View genIconForIOS.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
function createDir { | |
if [ ! -d $1 ]; then | |
mkdir $1 | |
fi | |
} | |
createDir ios |
View ConvertImages.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
function createDir { | |
if [ ! -d $1 ]; then | |
mkdir $1 | |
fi | |
} | |
createDir imageset | |
createDir imageset/drawable-xxxhdpi |
View STM32L_USART1.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "stm32l1xx.h" | |
int main(void) | |
{ | |
RCC->CR |= RCC_CR_HSEON; | |
while(!(RCC->CR & RCC_CR_HSERDY)); | |
RCC->APB2ENR |= RCC_APB2ENR_USART1EN; //USART1 Clock ON | |
USART1->BRR = 0xD05; // Bodrate for 9600 on 32Mhz | |
USART1->CR1 |= USART_CR1_UE | USART_CR1_TE | USART_CR1_RE; // USART1 ON, TX ON, RX ON |
View STM32L_Blink_Led.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "stm32l1xx.h" | |
void delay(unsigned int time) { | |
for (time; time > 0; time--); | |
} | |
int main(void) | |
{ | |
RCC->AHBENR |= RCC_AHBENR_GPIOBEN; |
View gist:8782988
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Name:RFID.pde | |
* Create:www.electrodragon.com | |
* Create date:2011.09.19 | |
* Function:Mifare1 searching card →prevent conflict→ select card →read write pins | |
*/ | |
// the sensor communicates using SPI, so include the library: | |
#include <SPI.h> | |
#define uchar unsigned char |
View STM32makefile.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
############################################################################################## | |
# | |
# On command line: | |
# | |
# make all = Create project | |
# | |
# make clean = Clean project files. | |
# | |
# To rebuild project do "make clean" and "make all". | |
# |
View Prepare4djvu.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
WIDTH="2880"; | |
HEIGHT="1868"; | |
SHIFT_X="880"; | |
SHIFT_Y="608"; | |
ORIENT="left"; | |
# If right page - first, insert "1", otherwise "0" | |
RIGHT_FIRST="1"; |
View mov2gif.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
ffmpeg -i video.MOV -r 6 image_%010d.png; | |
mkdir resized; | |
for i in image_*.png; do convert $i -resize 600 resized/$i; done | |
rm -f image_*.png; | |
cd resized; | |
convert -delay 10 -layers optimize *.png ../animation.gif | |
cd ..; | |
rm -fr resized; |
View gist:5896465
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import os | |
listRoms = os.listdir("."); | |
countRoms = len(listRoms); | |
for i in range(0, countRoms): | |
name = listRoms[i]; | |
if (name[-4:] == ".bin"): |
NewerOlder