This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* jshint node:true */ | |
'use strict'; | |
var gulp = require('gulp'); | |
var argv = require('yargs').argv; | |
var $ = require('gulp-load-plugins')(); | |
var angularTemplatecache = require('gulp-angular-templatecache'); | |
var del = require('del'); | |
var jshint = require('gulp-jshint'); | |
var jscs = require('gulp-jscs'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from PIL import Image | |
import csv | |
immagine = Image.open(my_tiff_FILE) | |
pixels = list(map(lambda i: i*2,list(immagine.getdata()))) | |
width, height = immagine.size | |
pixels = [pixels[i * width:(i + 1) * width] for i in range(height)] | |
print(pixels[0]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//rename | |
rename 's/pattern/new_string/' <files> | |
//upper-to-lower | |
for i in *; do mv $i `echo $i | tr [:upper:] [:lower:]`; done | |
//get apache user name | |
APACHEUSER=`ps aux | grep -E '[a]pache|[h]ttpd' | grep -v root | head -1 | cut -d\ -f1` | |
//set permission | |
sudo chmod g+rw "$APACHEUSER allow delete,write,append,file_inherit,directory_inherit" ./logs | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def add_field_to_layer(layer, string_value, int_value, real_value): | |
for v in string_value: | |
print(v) | |
field_name = ogr.FieldDefn(v, ogr.OFTString) | |
field_name.SetWidth(24) | |
layer.CreateField(field_name) | |
for v in int_value: | |
print(v) | |
f=ogr.FieldDefn(v, ogr.OFTInteger) | |
layer.CreateField(f) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_request_to_json(url, user_name, user_password): | |
auth_string = '%s:%s' % (user_name, user_password) | |
base64string = base64.b64encode(auth_string.encode('ascii')) | |
headers = {'Authorization': "Basic %s" % bytes.decode(base64string)} | |
try: | |
req = urllib.request.Request(url, None, headers) | |
response = urllib.request.urlopen(req) | |
return json.loads(bytes.decode(response.read())) | |
except IOError as e: | |
print(e) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Add the time zone offset to a data. | |
* | |
* | |
* @param {Date} data - The Date to transform. | |
*/ | |
function getDataWithOffset(data){ | |
var tzoffset = (new Date()).getTimezoneOffset() * 60000; | |
return new Date(data - tzoffset); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#git config --global core.editor nano | |
git config --global user.name "" | |
git config --global user.email "" | |
git config --global alias.co checkout | |
git config --global alias.br branch | |
git config --global alias.ci commit | |
git config --global alias.st status | |
git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ -x /usr/bin/lesspipe ] && eval "$(lesspipe)" | |
# | |
if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then | |
debian_chroot=$(cat /etc/debian_chroot) | |
fi | |
# | |
case "$TERM" in | |
xterm-color) | |
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' | |
;; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
A collection of method to manipulate string object in python. | |
The str object is a sequence, other example of sequence are: bytes, bytesarray, list, tuple, range | |
''' | |
def loToUpAndUpToLo(inputString): | |
''' | |
Switch the lowercase character to uppercase and uppercase to lowercase. | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use myAppNameSpace\App; | |
use Slim\Http\Environment; | |
use Slim\Http\Request; | |
/** | |
* Description of ExampeSlimTest | |
* | |
* @author daniele andreis |