One Paragraph of project description goes here
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
------------------------------------------------------------------------- | |
USEFUL ONE-LINE SCRIPTS FOR SED (Unix stream editor) Dec. 29, 2005 | |
Compiled by Eric Pement - pemente[at]northpark[dot]edu version 5.5 | |
Latest version of this file (in English) is usually at: | |
http://sed.sourceforge.net/sed1line.txt | |
http://www.pement.org/sed/sed1line.txt | |
This file will also available in other languages: | |
Chinese - http://sed.sourceforge.net/sed1line_zh-CN.html |
@receiver(pre_save, sender=Course) | |
def create_slug(sender, instance, *args, **kwargs): | |
instance.slug = orig = slugify(instance.name) | |
if Course.objects.filter(slug=instance.slug).exists(): | |
# Creates a unique slug, adding -number when its already used. | |
for x in itertools.count(1): | |
if not Course.objects.filter(slug=instance.slug).exists(): | |
break | |
instance.slug = '%s-%d' % (orig, x) |
grep sshd.*Did /var/log/auth.log | less |
grep sshd.\*Failed /var/log/auth.log | less |
#!/bin/bash | |
logfile="/var/lib/postgresql/backups/pgsql.log" | |
backup_dir="/var/lib/postgresql/backups" | |
touch $logfile | |
databases=`psql -h localhost -U postgres -q -c "\l" | sed -n 4,/\eof/p | grep -v rows\) | grep -v template0 | grep -v template1 | awk {'print $1'}` | |
echo "Starting backup of databases " >> $logfile | |
for i in $databases; do | |
dateinfo=`date '+%Y-%m-%d %H:%M:%S'` | |
timeslot=`date '+%Y%m%d%H%M'` |
# Replaces whitespaces with underscore of all files from this location | |
import os | |
path = os.getcwd() | |
filenames = os.listdir(path) | |
for filename in filenames: | |
os.rename(os.path.join(path, filename), os.path.join(path, filename.replace(' ', '_'))) |
http://www.transantiago.cl/restservice/rest/getpuntoparada?lat=-33.6089714&lon=-70.5742975&bip=1
http://www.transantiago.cl/predictor/prediccion?codsimt=PA420&codser=504
(c贸digo de servicio es opcional, pero el par谩metro debe estar presente aunque est茅 vac铆o)
http://www.transantiago.cl/restservice/rest/getservicios/all
def print_categories(self): | |
''' Return categories as text for printing on templates ''' | |
return ''.join( | |
[x.name +'-' for x in self.category.all().order_by('name')] | |
)[:-1] # Removes last '-' |