Astuces Debian

#Avoir les meillleurs mirroirs Debian :
apt-spy

#Options interessantes :
-d STABLE | TESTING | UNSTABLE
-l /etc/monfile.list ( pour sauvegarder les liste ailleurs que dans le /etc/apt/sources.list)

#Ou sont mes paquets Debian ?
/var/cache/apt/archives

#Quelle est la version de mon paquet :
apt-cache policy paquet

#Reconfigurer son server graphique sous debian :
dpkg-reconfigure xserver-xorg ou xserver-xfree86

#Rechercher un paquet installé sur sa machine :
dpkg –l | grep nom_paquet [astuces] [debian]

Posted in astuces | Leave a comment

[HTML/Javascript] upload a file / submit a form when a file is selected

<input type="file" onchange="this.submit()" name="myfile" /> [file] [form] [html] [javascript] [select] [selected] [submit] [upload]

Posted in astuces | Leave a comment

softwares de mesure de bande passante en console

cbm, bmon (plusieurs interfaces réseau)
iftop (spécifique à une interface, résultats détaillés) [bande passante] [linux] [réseau] [software] [traffic]

Posted in astuces | Leave a comment

Google Search optimized for Streamline Theme

<div id="navbarright">
<form action="http://www.kaosklub.com" id="searchform">
<input type="hidden" name="cx" value="partner-pub-8683538658017137:5acdqp-99t9" />
<input type="hidden" name="cof" value="FORID:11" />
<input type="hidden" name="ie" value="ISO-8859-1" />
<input type="text" value="" name="q" size="15" id="searchbox" onfocus="if (this.value == ‘Buscar…’) {this.value = ”;}" onblur="if (this.value == ”) {this.value = ‘Buscar…’;}" />
<input type="submit" name="sa" id="searchbutton" value="OK" />
</form>
</div>

</div>
<div id="wrap">
<div align="center" id="cse-search-results" align="justify"></div>
<script type="text/javascript">
var googleSearchIframeName = "cse-search-results";
var googleSearchFormName = "cse-search-box";
var googleSearchFrameWidth = 850;
var googleSearchDomain = "www.google.es";
var googleSearchPath = "/cse";
</script>
<script type="text/javascript" src="http://www.google.com/afsonline/show_afs_search.js"></script> [Streamline] [theme] [wordpress]

Posted in astuces | Leave a comment

Limit Post plugin

<?php
/*
Plugin Name: Limit Posts
Plugin URI: http://labitacora.net/comunBlog/limit-post.phps
Description: Limits the displayed text length on the index page entries and generates a link to a page to read the full content if its bigger than the selected maximum length.
Usage: the_content_limit($max_charaters, $more_link)
Version: 1.1
Author: Alfonso Sánchez-Paus Díaz y Julián Simón de Castro
Author URI: http://labitacora.net/
License: GPL
Download URL: http://labitacora.net/comunBlog/limit-post.phps
Make:
In file index.php
replace the_content()
with the_content_limit(1000, "more")
*/

function the_content_limit($max_char, $more_link_text = ‘(more…)’, $stripteaser = 0, $more_file = ”) {
$content = get_the_content($more_link_text, $stripteaser, $more_file);
$content = apply_filters(‘the_content’, $content);
$content = str_replace(‘]]>’, ‘]]&gt;’, $content);
$content = strip_tags($content);

if (strlen($_GET['p']) > 0) {
echo "";
echo $content;
echo "";
}
else if ((strlen($content)>$max_char) && ($espacio = strpos($content, " ", $max_char ))) {
$content = substr($content, 0, $espacio);
$content = $content;
echo "";
echo $content;
echo "…";
echo "";
}
else {
echo "";
echo $content;
echo "";
}
}

?> [Limit Post] [plugin]

Posted in astuces | Leave a comment

Non-ASCII character when running Python scripts

En en-tête du script, apres le shebang (#!/usr/bin/env python en général, ou #!/usr/bin/python), insérer la ligne suivante afin de forcer l’encodage a utf-8 (car python par défaut utilise ASCII):

# -*- coding: utf-8 -*- [ascii] [encoding] [python] [utf8]

Posted in astuces | Leave a comment

ajouter un compte à un .htpasswd

htpasswd -c /mon_chemin/.htpasswd user [apache] [bash] [compte] [htpasswd]

Posted in astuces | Leave a comment

Limit with MSSQL

DECLARE @Start datetime,
@End datetime

SELECT @Start = 11,
@End = 20

SELECT objName, CrDate
FROM (SELECT ROW_NUMBER() OVER (ORDER BY name)
AS Row, convert(varchar(30), name) as objName, crDate FROM sysobjects)
AS DatabaseObjects
WHERE Row >= @Start AND Row <= @End [LIMIT] [MSSQL]

Posted in astuces | Leave a comment

Mount Free HD

tu combines FUSE et FTPFS avec curlftpfs ça marche très bien,
après, a toi de scripter ce que tu veux, check hdd, download, rsync etc …

expl : /etc/fstab
[code]curlftpfs#freebox:password@hd1.freebox.fr /mnt/ftpfs/hd1.freebox.fr fuse rw,uid=1000,user,auto 0 0[/code]
cd /mnt/ftpfs/hd1.freebox.fr

ou en autofs etc…

Posted in astuces | Leave a comment

HTML UFT8

<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />

AddType ‘text/html; charset=UTF-8′ html

Posted in astuces | Leave a comment