Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
# if you want no parents folders at current path, add: --no-parent
# if you want no subfolders: --cut-dirs=[n]
# if you want no hosts folders: --no-host-directories
# ref https://stackoverflow.com/questions/5043239/how-do-i-mirror-a-directory-with-wget-without-creating-parent-directories
# Include resources on a different domain: --span-hosts
# ref https://superuser.com/questions/129085/make-wget-download-page-resources-on-a-different-domain
wget \
--no-clobber \
--convert-links \
<?php
function buildSelect($tableStruct){
$queryString = "SELECT ";
$queryBinds = array();
$sqlQueryFields = array(
"states.id",
"states.code",
"states.name"
);
#!/usr/bin/bash
let dlStart="$(date +%s)"
# do something
let dlEnd="$(date +%s)"
let diffe="$dlEnd-$dlStart"
echo $diffe
#!/usr/bin/python
import re
import sys
import getopt
import csv
import json
import string
def to_snake_case(name):
s1 = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', name)
@rogersguedes
rogersguedes / codeIgniterUcfirstRename.sh
Last active July 26, 2016 19:47
This snippet can be used to rename models in codeigniter frame work in agreement to ucfirst rule;
find . -maxdepth 1 \! -iname "." -exec "rename" "s/([A-Za-z0-9])([a-zA-Z0-9]+)/\$1\\L\$2/" {} ";"
@rogersguedes
rogersguedes / meuAleloExport.js
Last active August 13, 2016 18:34
Snippet para imprimir no console os valores obtidos de uma consulta de saldo no www.meualelo.com.br
// First, checks if it isn't implemented yet.
if (!String.prototype.format) {
String.prototype.format = function() {
var args = arguments;
return this.replace(/{(\d+)}/g, function(match, number) {
return typeof args[number] != 'undefined'
? args[number]
: match
;
});
@rogersguedes
rogersguedes / downloadOraclePackage.sh
Created August 15, 2016 23:22
This script let's download Java packages from Orale site usign wget. What's very nice if you has nor GUI neither browser like ssh sessions
#!/usr/bin/bash
wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" $1
@rogersguedes
rogersguedes / main.c
Created August 18, 2016 02:16
code snippet in C to explain to people how pipes works.
#include <stdio.h>
#include <stdlib.h>
int main(void){
char input[32];
printf("Digite alguma coisa: ");
fflush(stdout);
scanf("%31[^\n]", &input);
printf("você digitou: %s\n", input);
return EXIT_SUCCESS;
}
@rogersguedes
rogersguedes / start_mysqld.bat
Last active August 23, 2016 09:50
mysqld command line options to turn on MySQL daemon on Windows
start bin\mysqld.exe --defaults-file=my.ini --standalone
@rogersguedes
rogersguedes / stop_mysqld.bat
Created August 23, 2016 09:47
mysqladmin command line options to turn off MySQL daemon on Windows
bin\mysqladmin.exe -u root shutdown -p