Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.
– The Git website
Choose one of the following options.
#! /bin/sh | |
# Pull all files; | |
# Minimum percentage change to whatever you want | |
tx pull -a --minimum-perc=100 | |
# Create .mo files from .po files. | |
# Twisted by WP-Translations.org, created by grappler. | |
for file in `find . -name "*.po"` ; do msgfmt -o ${file/.po/.mo} $file ; done |
git branch -m old_branch new_branch # Rename branch locally | |
git push origin :old_branch # Delete the old branch | |
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote |
#!/bin/bash | |
# Run the below script only after "Install NDIS driver failed" error while trying to install Huawei modem drivers on linux. | |
# I checked this script on Ubuntu. | |
# Detailed explanation of this script was given here(http://askubuntu.com/a/414401/202806). | |
path="/usr/local/Mobile_Partner/driver" | |
if [ "$(ls -A $path)" ]; then | |
tput setaf 6; echo "Huawei modem drivers for linux are already installed on your pc.Please wait for NDIS driver installation."; tput sgr0 | |
perl -i -pe 's#^(\s*dbg \("can.t kmalloc dev"\);)#//$1#' /usr/local/Mobile_Partner/driver/ndis_driver/ndis_src/src/hw_cdc_driver.c | |
cd $path |
""" | |
Field with multiple *static* choices (not via m2m) | |
Value is stored in DB as comma-separated values | |
Default widget is forms.CheckboxSelectMultiple | |
Python value: list of values | |
Original Django snippet: https://djangosnippets.org/snippets/1200/ | |
It's 6 years old and doesn't work with latest Django | |
Also it implements 'max_choices' functionality - I have removed it for simplicity |
>>> from indico.modules.rb.models import Photo | |
>>> Photo.room | |
AttributeError: type object 'Photo' has no attribute 'room' | |
>>> db.session.query(Photo) | |
<sqlalchemy.orm.query.Query at 0x8211490> | |
>>> Photo.room | |
<sqlalchemy.orm.attributes.InstrumentedAttribute at 0x81c8090> |
from zope.schema import getFields | |
from zope.interface import providedBy | |
from zope.interface import implementedBy | |
from zope.component import getUtility | |
from zope.component import queryUtility | |
from plone.behavior.interfaces import IBehavior | |
from plone.behavior.interfaces import IBehaviorAssignable | |
from plone.dexterity.interfaces import IDexterityFTI | |
from plone.dexterity.utils import resolveDottedName |
Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.
– The Git website
Choose one of the following options.
my_list = ['peach', 'grape', 'apple'] | |
query_parameters = {} | |
counter = 1 | |
for list_item in my_list: | |
query_parameters["list_item" + str(counter)] = list_item | |
counter += 1 | |
where_clause = 'fruits IN(:' + ",:".join(query_parameters.keys()) + ')' # create clause to be inserted into query | |
query_text = db.text(""" | |
SELECT |
########################################################################### | |
# | |
## @file database.py | |
# | |
########################################################################### | |
import sqlite3 | |
########################################################################### | |
# |
# | |
# Auth filter /etc/fail2ban/filter.d/nginx-auth.conf: | |
# | |
# Blocks IPs that makes too much accesses to the server | |
# | |
[Definition] | |
failregex = ^<HOST> -.*"(GET|POST).*HTTP.*" | |
ignoreregex = |