Skip to content

Instantly share code, notes, and snippets.

View AV4TAr's full-sized avatar

Diego Sapriza AV4TAr

View GitHub Profile
<?php
//consulto la base y tengo id => nombre
$resultados_query_array = BD::query("SELECT...");
$id_registro_seleccionado = 25;
echo "<select>";
foreach($resultados_query_array as $registro_id => $registro_nombre){
if($registro_id == $id_registro_seleccionado){
echo '<option value='.$registro_id.' selected="selected">'.$registro_nombre.'</option>';
} else {
<?php
function file_get_contents_utf8($fn) {
$content = file_get_contents($fn);
return mb_convert_encoding($content, 'UTF-8',
mb_detect_encoding($content, 'UTF-8, ISO-8859-1', true));
}
?>
@AV4TAr
AV4TAr / gist:2955045
Created June 19, 2012 16:16
pgsql backup script v1 command line
set PGPASSWORD=diego
set PGUSER=dsapriza
set PGHOST=localhost
set PGPORT=5432
pg_dump.exe my_database > backup.sql
@AV4TAr
AV4TAr / gist:2955071
Created June 19, 2012 16:21
mysql backup script
#!/bin/sh
DATE=`date +%a`
DEST=/srv/backups
FILE=$DEST/mysql-bkp-${DATE}.sql.gz
mysqldump -uMY_USERNAME -pMY_PASSWORD MY_DATABASE | gzip > $FILE
[{
"id": "9223372035807",
"name": "The Christ Hospital",
"office": {
"id": "3",
"name": "New York",
"code": "NY",
"description": "Our NY office",
"minappversion": "v2011.09.27.0",
},
@AV4TAr
AV4TAr / gist:3219880
Created July 31, 2012 19:42
tablesorter gustavo
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-us">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type="text/javascript" src="./js/jquery-latest.js"></script>
<script type="text/javascript" src="./js/jquery.tablesorter.min.js"></script>
<link rel="stylesheet" href="./css/style.css" type="text/css" media="print, projection, screen" />
<script type="text/javascript">
@AV4TAr
AV4TAr / gist:3450009
Created August 24, 2012 12:26
ping example 1
[~] ➔ ping google.com
PING google.com (200.40.0.84): 56 data bytes
64 bytes from 200.40.0.84: icmp_seq=0 ttl=59 time=8.035 ms
64 bytes from 200.40.0.84: icmp_seq=1 ttl=59 time=8.088 ms
64 bytes from 200.40.0.84: icmp_seq=2 ttl=59 time=48.853 ms
64 bytes from 200.40.0.84: icmp_seq=3 ttl=59 time=16.623 ms
64 bytes from 200.40.0.84: icmp_seq=4 ttl=59 time=24.865 ms
^C
--- google.com ping statistics ---
5 packets transmitted, 5 packets received, 0.0% packet loss
@AV4TAr
AV4TAr / gist:3450095
Created August 24, 2012 12:37
siginfo ping macos
[~] ➔ ping google.com
PING google.com (200.40.0.84): 56 data bytes
64 bytes from 200.40.0.84: icmp_seq=0 ttl=59 time=22.144 ms
64 bytes from 200.40.0.84: icmp_seq=1 ttl=59 time=8.602 ms
64 bytes from 200.40.0.84: icmp_seq=2 ttl=59 time=53.278 ms
64 bytes from 200.40.0.84: icmp_seq=3 ttl=59 time=11.416 ms
64 bytes from 200.40.0.84: icmp_seq=4 ttl=59 time=7.842 ms
64 bytes from 200.40.0.84: icmp_seq=5 ttl=59 time=14.848 ms
load: 0.86 cmd: ping 20845 running 0.00u 0.00s
6/6 packets received (100.0%) 7.842 min / 19.688 avg / 53.278 max
@AV4TAr
AV4TAr / gist:3450177
Created August 24, 2012 12:48
ping siginfo
...
load: 0.86 cmd: ping 20845 running 0.00u 0.00s
6/6 packets received (100.0%) 7.842 min / 19.688 avg / 53.278 max
...
@AV4TAr
AV4TAr / gist:3516250
Created August 29, 2012 17:55
addins.json
[{
"addin_id": "1",
"name": "Delete Views And Purge",
"desc": "Free",
"updated": "2012-08-06 15:09:35",
"version": "2012.7.24.0",
"revit_version": "2012",
"cost": "0",
"tier": "0",
"platform": "Revit",