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
#! /usr/bin/env python | |
import sys | |
def progress(s): | |
print("%-80s\r" % s, file=sys.stderr, end='') | |
def solve2(line): |
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
/* | |
It is not possible to shrink a tablespace that's being used, in order to reclaim the unused space you can use this script (remember to change the value of OLD_TBSP variable) | |
The script essentially does the following: | |
- create a new tablespace appending "_TMP" at the end, it's going to use a datafile with the same name, adding (or incrementing) an id; | |
- move all the object from the old tablespace to the new one; | |
(this means that on the filesystem there should be enough space for the new datafile, consider also the extra space for the index rebuild!) | |
- prints the commands to execute in order to drop the old tablespace and rename the new. | |
At the end it is possible that the space on the filesystem is not freed, follow the instructions here: http://serverfault.com/questions/501963/how-to-recover-free-space-on-deleted-files-without-restarting-the-referencing-pr |
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
#!/usr/bin/python3 | |
from random import randrange, random | |
from fractions import Fraction | |
from functools import reduce | |
from operator import mul | |
def pf(f): | |
'''Pretty print the fraction''' | |
return "{}/{}".format(f.numerator,f.denominator) |
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
#!/bin/bash | |
if [ ! -f ~/.ssh/id_rsa.pub ]; then | |
ssh-keygen | |
fi | |
echo "Server host:" | |
read SRV | |
echo "User on the server host:" |
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
' inspired by: | |
' http://stackoverflow.com/questions/2557606/how-do-i-associate-parameters-to-command-objects-in-ado-with-vbscript | |
' http://stackoverflow.com/questions/10352211/vba-ado-connection-and-query-parameters | |
' The function takes three parameters: ADOConnection; sql (string); params, an Array() of parameters | |
Function sqlOperationParametric(ADOConnection,sql,params) | |
Dim Cm, Pm, i, p | |
Set Cm = CreateObject("ADODB.Command") | |
With Cm |
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
#!/bin/bash | |
PROXY_IP=192.168.1.100 | |
PROXY_PORT=4444 | |
ssh -N -D $PROXY_PORT $PROXY_IP & | |
ID=$! | |
chromium-browser --proxy-server="socks://127.0.0.1:$PROXY_PORT" | |
kill $ID |
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
' executes the query to the DB while the results is not as expected | |
' the query MUST return at least one record with a field named CHECK_VAL | |
' the loop will stop when CHECK_VAL = check_val (Function parameter) | |
' or when the timeout is reached (milliseconds) | |
' the return value will be True (check ok) or False (timeout reached) | |
' waitBetweenQueries is the milliseconds to wait between the query execution | |
Function waitUntilSQL(connection, sql, check_val, timeout, waitBetweenQueries) | |
Dim response, startTime | |
' default values | |
If IsEmpty(timeout) Then timeout = 60000 |
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
DECLARE | |
a dbms_utility.uncl_array; | |
len PLS_INTEGER; | |
input_string STRING(999) := '0099905666,0099905667,0099905668,0099905669'; | |
my_code STRING(99); | |
BEGIN | |
-- add a letter to make it works | |
input_string := 'x' || Replace(input_string,',',',x'); | |
-- convert the string in an array | |
dbms_utility.Comma_to_table(input_string, len, a); |
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
set long 10000000 | |
set head off | |
set echo off | |
set pagesize 0 | |
set verify off | |
set feedback off | |
SET LINESIZE 32000 | |
COL ddl FORMAT A32000 | |
spool schema.sql |
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
#!/bin/bash | |
# usage: | |
# $0 path/to/image/or/dir path/to/destination/dir | |
# | |
# the file will be renamed using EXIF data: | |
# YYYYMMDD-image_name | |
# | |
# if the second parameter is specified, a directory structure will be created: | |
# path/to/destination/dir/YYYY/YYYY-MM/image_new_name |