Skip to content

Instantly share code, notes, and snippets.

@limtbk
limtbk / game_of_life.pyde
Last active December 2, 2015 21:32 — forked from dmitmel/game_of_life.pyde
Game of life
s1x = 30
s1y = 30
s2 = 20
gen = []
next_gen = []
clicks = []
zero = 50
one = 250
@limtbk
limtbk / ArduinoProMiniFade.ino
Created December 9, 2015 15:30
Test firmware for GoITeens Arduino's
void setup() {
pinMode(13, OUTPUT);
}
void loop() {
static uint16_t t = 0;
static uint8_t k = 0;
static int8_t i = 1;
t++;
@limtbk
limtbk / genicons.sh
Created December 18, 2015 08:50
iOS icons automate generator
#!/bin/bash
f=$(pwd)
sips --resampleWidth 512 "${f}/${1}" --out "${f}/iTunesArtwork"
sips --resampleWidth 1024 "${f}/${1}" --out "${f}/iTunesArtwork@2x"
sips --resampleWidth 29 "${f}/${1}" --out "${f}/${2}-29.png"
sips --resampleWidth 58 "${f}/${1}" --out "${f}/${2}-29@2x.png"
sips --resampleWidth 87 "${f}/${1}" --out "${f}/${2}-29@3x.png"
@limtbk
limtbk / MathPuzzle.java
Created December 23, 2015 13:53
Using numbers 1, 3, 4, 6 and math operators +, -, *, / get the number 24
public class MathPuzzle {
public static float getNumber(String eq)
{
float[] stackArray = new float[100];
int stackPointer = 0;
for (int i = 0; i < eq.length(); i++) {
char c = eq.charAt(i);
if ((c>='0') && (c<='9'))
@limtbk
limtbk / ImgExtract.py
Created January 18, 2016 23:51
How to extract image with alpha from several screenshots with known background and image with alpha on it (not very precision)
from PIL import Image
im0 = Image.open("IMG_1.PNG")
im1 = Image.open("IMG_2.PNG")
im2 = Image.open("IMG_3.PNG")
im3 = Image.open("IMG_4.PNG")
size = im0.size
pix0 = im0.load()
pix1 = im1.load()
pix2 = im2.load()
pix3 = im3.load()
@limtbk
limtbk / radio-t_record.sh
Created February 6, 2016 08:47
Record Radio-t podcast
#!/bin/bash
NOW=$(date +"%Y-%m-%d")
NUMBER=`cat radio-t_number`
RADIOTDIR=~/RadioT/${NUMBER}_${NOW}
mkdir -p $RADIOTDIR
cd $RADIOTDIR
while [ ! -f stream.m3u ]; do
wget http://stream.radio-t.com:8181/stream.m3u
#include <ESP8266WiFi.h>
#include <WiFiUdp.h>
#include <DNSServer.h>
#include <ESP8266WebServer.h>
#include <Adafruit_NeoPixel.h>
#include "FS.h"
//const char ssid[] = "AnchorFree";
//const char pass[] = "wifi4free!";
@limtbk
limtbk / t1.c
Last active January 23, 2018 05:30
#include <stdio.h>
#define abs(x) ((x)<0 ? -(x) : (x))
double calc_prec(double x, double pr)
{
double s = 0;
double n = 1;
double k = 1;
double xx = x;
@limtbk
limtbk / t2.c
Last active January 23, 2018 06:07
#include <stdio.h>
void reverse_array(int *arr, int start, int end)
{
for (int i = start; i < (start + end) / 2; i++)
{
arr[i] ^= arr[end + start - i - 1];
arr[end + start - i - 1] ^= arr[i];
arr[i] ^= arr[end + start - i - 1];
}
@limtbk
limtbk / t3.c
Last active January 23, 2018 07:20
You need text file "f" for input, that contains numbers divided by enter and ended by enter
#include <stdio.h>
#include <stdlib.h>
int main()
{
FILE *f, *g, *h;
f = fopen("f", "r");
g = fopen("g", "w");
h = fopen("h", "w");