Skip to content

Instantly share code, notes, and snippets.

@ZiTAL
ZiTAL / spawn-fcgi.sh
Last active Dec 19, 2015 — forked from ozeias/spawn-fcgi.sh
spawn-fcgi daemon for python fastcgi projects on debian gnu/linux. original https://gist.github.com/ozeias/47394
View spawn-fcgi.sh
#! /bin/sh
### BEGIN INIT INFO
# Provides: spawn-cgi
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: fastcgi for python
# Description: fastcgi for python using nginx
# placed in /etc/init.d.
@ZiTAL
ZiTAL / eitbcom11
Created Mar 3, 2014
apache virtualhost
View eitbcom11
#a2ensite eitbcom11
#ln -s /etc/apache2/sites-available/eitbcom11 /etc/apache2/enabled/eitbcom11
#Listen 80
<VirtualHost *:80>
ServerAdmin bilbao_iban@eitb.com
DocumentRoot /home/projects/eitbcom11/public_html
ServerName eitbcom11.iban
<FilesMatch "^\.ht">
@ZiTAL
ZiTAL / mail.py
Created Mar 28, 2014
python send mail
View mail.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys, re, smtplib
class Mail(object):
params = {}
server = {}
View firefoxos marketplace count total donwloads
// first select start and end dates
var sum = 0;
var a = document.querySelectorAll('.bar-wrapper.single > ul > li > span > em');
var l = a.length;
for(var i=0;i<l;i++)
sum = sum + Math.round(a[i].childNodes[0].nodeValue);
window.alert(sum);
@ZiTAL
ZiTAL / bom.py
Last active Aug 29, 2015
Python: Remove BOM from UTF-8 files
View bom.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys, os, re, binascii
if(len(sys.argv)<2):
print 'Errorea: Karpeta argumentu bidez sartu'
sys.exit()
else:
dir = sys.argv[1]
@ZiTAL
ZiTAL / telegram.js
Last active Sep 28, 2017
telegram js api
View telegram.js
'use strict';
var bin_utils = require('./bin_utils.js');
var tl_utils = require('./tl_utils.js');
var utils = require('./utils.js');
var telegram = function(publisKeysHex)
{
var publicKeysParsed = {};
@ZiTAL
ZiTAL / gist:e03fb854f9925754d54b
Last active Aug 29, 2015
php file_get_contents from ftp
View gist:e03fb854f9925754d54b
<?php
$a = tmpfile();
$metaData = stream_get_meta_data($a);
$ftp = ftp_connect('localhost', 21, 30);
ftp_login($ftp, 'zital', 'zital');
ftp_fget($ftp, $a, 'a.txt', FTP_BINARY, 0);
fseek($a, 0);
@ZiTAL
ZiTAL / rmdirr
Created Oct 1, 2014
php delete folders recursively
View rmdirr
function rmdirr($folder)
{
$aDeny = array('.', '..');
$resources = scandir($folder);
foreach($resources as $r)
{
if(!in_array($r, $aDeny))
{
$tmp = $folder."/".$r;
if(is_dir($tmp))
@ZiTAL
ZiTAL / ws-cli.php
Created Oct 29, 2014
php: simple websocket client
View ws-cli.php
<?php
/*
based on: http://stackoverflow.com/questions/7160899/websocket-client-in-php/16608429#16608429
FIRST EXEC PYTHON SCRIPT TO GET HEADERS
*/
$ws = new ws(array
(
'host' => '127.0.0.1',
'port' => 8080,
@ZiTAL
ZiTAL / zitalbot.py
Created Nov 4, 2014
#zitalbot python twitter bot
View zitalbot.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# requirements:
# pip install tweepy
import sys, re, tweepy
class Txio(object):
params = {}
You can’t perform that action at this time.