Skip to content

Instantly share code, notes, and snippets.

@ZiTAL
ZiTAL / get_file_from_ftp.sh
Created June 12, 2015 14:18
bash: get file from ftp
#!/bin/bash
host='127.0.0.1'
user='user'
passwd='passwd'
local_folder='/home/projects/example/public_html/application/views/layout/heavymetal'
remote_folder='/public_html/application/views/layout/heavymetal'
file='heavymetal_eu.php'
@ZiTAL
ZiTAL / README.txt
Last active August 29, 2015 14:23
Ralink 148f:7601
# script-eri aldatu "_" "/" euren path-a jakitzeko
# gero github-etik proeiktue bajatu
cd /usr/src
git clone https://github.com/porjo/mt7601.git
# baimenak emon
chmod 755 /etc/init.d/ralink
chmod 755 /usr/local/sbin/ralink
@ZiTAL
ZiTAL / index.php
Last active June 30, 2021 18:45
php: telegram bot api example
<?php
// get API KEY: https://core.telegram.org/bots#botfather
// get chad id: http://stackoverflow.com/questions/31078710/how-to-obtain-telegram-chat-id-for-a-specific-user
$api_key = 'FAKE1234';
$chat_id = '7850602'
$url = "https://api.telegram.org/bot".$api_key."/";
// UNCOMMENT desired method
@ZiTAL
ZiTAL / rpi_play.py
Last active November 23, 2016 14:22
Raspberry Pi video launcher
#!/usr/bin/python2
# -*- coding: utf-8 -*-
from sys import exit, argv
from os import walk, path, system, popen, path
from glob import glob
import re
# allowed extensions
ext_allow = ['mp4', 'avi', 'webm', 'ogv', 'ogg', 'mkv', 'flv', 'vob', 'mov', 'wmv', 'm4v', 'mpg', '3gp']
@ZiTAL
ZiTAL / map.js
Last active August 29, 2015 14:27
// array guztiari funtzio bera aplikatzeko erabiliko dugu
var zenbakiak = [1, 2, 3];
// funtzioak parametro moduan array-aren balorea hartzen du (i)
var erantzuna = zenbakiak.map(function(i)
{
return i+1;
});
console.log(erantzuna);
// [ 2, 3, 4 ]
#!/bin/bash
host='127.0.0.1'
user='user'
pass='passwd'
local_folder='/home/projects/example/public_html/application/views/layout/home'
remote_folder='/public_html/application/views/layout/home'
file='home_eu.php'
@ZiTAL
ZiTAL / hm10.php
Last active October 15, 2015 12:17
php: get ibeacons address and distance from arduino's HM10 Bluetooth module
<?php
// HM10 Bluetooth arduino modules response example
$text = "OK+DISISOK+DISC:4C000215:74278BDAB64445208FOC720EAF059935:FFEOFFE1C5:78A5048CECAC:-0620K+DISC:4C000215:74278BDAB64445208F0C720EAf059935:FFFE0FFE1C5:78A50485AF2D:-0580K+DISCE";
//preg_match_all("/\+DISC\:([A-Z0-9]+\:[A-Z0-9]+\:[A-Z0-9]+\:[A-Z0-9]+)\:([A-Z0-9\-]+)/", $text, $m);
preg_match_all("/\+DISC\:(\w+\:\w+\:\w+\:\w+)\:([\w\-]+)/", $text, $m);
print_r($m);
// output
@ZiTAL
ZiTAL / .htaccess
Last active October 23, 2015 11:27
apache rewrite: caching resources with pretty urls
# /resources/js/example.js/123456/ -> /resources/js/example.js
# /resources/css/example.css/123456/ -> /resources/css/example.css
RewriteRule ^(.+\.)(js|css)/\d+/?$ /$1$2 [NC,L]
@ZiTAL
ZiTAL / canvas clock
Last active November 13, 2015 15:58
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>w3cschools</title>
<script type="text/javascript">
(function()
{
"use strict";
#include <SoftwareSerial.h>
#include <Regexp.h>
SoftwareSerial BT(7, 8);
void setup()
{
BT.begin(9600);
Serial.begin(9600);
}