Skip to content

Instantly share code, notes, and snippets.

View ivanjr0's full-sized avatar

Ivan Soares ivanjr0

  • Belo Horizonte, Brazil
View GitHub Profile
{
int i; int j; float v; float x; float[100] a;
while( true ) {
do i = i+1; while( a[i] < v);
do j = j-1; while( a[j] > v);
if( i >= j ) break;
x = a[i]; a[i] = a[j]; a[j] = x;
}
}
import re
import shlex
from glob import glob
from subprocess import Popen, PIPE
#include <cmath>
#include <cassert>
#include <iostream>
#include <string>
#include <sstream>
using namespace std;
bool is_subseq(const string &h, const string &n) {
int j = 0;
#include <cmath>
#include <cassert>
#include <iostream>
#include <string>
#include <sstream>
using namespace std;
bool is_subseq(const string &str2, const string &str1) {
int m = str1.size();
DECLARE @SQL varchar(max);
set @SQL =
'
SELECT ''TFA-2073-TR04-PIT-01'' as tag, MIN(ip_trend_time) FROM "TFA-2073-TR04-PIT-01" ORDER BY ip_trend_time UNION
SELECT ''TFA-2073-TR03-TIT-13'' as tag, MIN(ip_trend_time) FROM "TFA-2073-TR03-TIT-13" ORDER BY ip_trend_time UNION
SELECT ''TFA-2073-TR03-TIT-06'' as tag, MIN(ip_trend_time) FROM "TFA-2073-TR03-TIT-06" ORDER BY ip_trend_time UNION
SELECT ''TFA-2073-TR03-TIT-05'' as tag, MIN(ip_trend_time) FROM "TFA-2073-TR03-TIT-05" ORDER BY ip_trend_time UNION
SELECT ''TFA-2073-TR02-WIT-01'' as tag, MIN(ip_trend_time) FROM "TFA-2073-TR02-WIT-01" ORDER BY ip_trend_time UNION
SELECT ''TFA-2073-TR03-TIT-14'' as tag, MIN(ip_trend_time) FROM "TFA-2073-TR03-TIT-14" ORDER BY ip_trend_time UNION
SELECT ''TFA-2073-TR03-TIT-01'' as tag, MIN(ip_trend_time) FROM "TFA-2073-TR03-TIT-01" ORDER BY ip_trend_time UNION
import os
import json
from pprint import pprint
from collections import defaultdict
import click
import numpy as np
import matplotlib.pyplot as plt
WIDTH=32;
DEPTH=1024;
ADDRESS_RADIX=UNS;
DATA_RADIX=BIN;
CONTENT BEGIN
00: 00100000000010010000000000000000;
@ivanjr0
ivanjr0 / deltat.py
Created September 30, 2013 12:11
Lê o stdin e para cada linha imprime a diferença de tempo.
from __future__ import print_function
import sys
import time
def main():
t0 = time.time()
while 1:
git add . >> /dev/null
git commit -m "parcial commit (backup)" >> /dev/null
git push origin `git rev-parse --abbrev-ref HEAD`:backup -f >> /dev/null
git reset HEAD~1 >> /dev/null
@ivanjr0
ivanjr0 / downloader.py
Created July 3, 2013 15:42
CurlMulti based downloader
# -*- coding: utf-8 -*-
# NOQA # Baseado em http://pycurl.cvs.sourceforge.net/viewvc/pycurl/pycurl/examples/retriever-multi.py?view=markup
try:
import signal
from signal import SIGPIPE, SIG_IGN
signal.signal(signal.SIGPIPE, signal.SIG_IGN)
except ImportError:
pass