Skip to content

Instantly share code, notes, and snippets.

View ironsmile's full-sized avatar

Doychin Atanasov ironsmile

View GitHub Profile
?- len(R).
ERROR: toplevel: Undefined procedure: len/1 (DWIM could not correct goal)
?- R
| .
% ... 1,000,000 ............ 10,000,000 years later
%
% >> 42 << (last release gives the question)
#define RP_STORE_COMP(x) \
current = sel_storeges->data[x]; \
stor = stor_weights->data[current.value]; \
switch(wt){ \
\
case RP_WEIGHT_SPEED: \
if(stor.speed > best){ \
best = stor.speed; \
best_id = x; \
} \
/* ----------------------------------------------------------------------------
* "THE BEER-WARE LICENSE" (Revision 42):
* <phk@login.dknet.dk> wrote this file. As long as you retain this notice you
* can do whatever you want with this stuff. If we meet some day, and you think
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
* ---------------------------------------------------------------------------- */
class kalendar{
public:
char month[10];
int day;
char hour[5];
void days(char m[10], int d, char h[5]){
this->month[10] = m[10];
this->day = d;
this->hour[5] = h[5];
/*
Christmas stuff
I don't have any idea who wrote this but it is somewhat cool.
Compile and run it!
*/
#include <stdio.h>
main(t,_,a)
char *a;
{return!0<t?t<3?main(-79,-13,a+main(-87,1-_,
@ironsmile
ironsmile / gist:997831
Created May 29, 2011 14:53
different results
iron4o@norad4$ ./ctimer-full
868[~/Desktop]
iron4o@norad4$ ./ctimer-full
832[~/Desktop]
iron4o@norad4$ ./ctimer-full
849[~/Desktop]
iron4o@norad4$ ./ctimer-full
905[~/Desktop]
iron4o@norad4$ ./ctimer-full
817[~/Desktop]
@ironsmile
ironsmile / gist:997849
Created May 29, 2011 15:14
ctimer for blago
#include <iostream>
#include <sys/time.h>
int main (int argc, char * const argv[]) {
timeval start, end;
long mtime, seconds, useconds;
gettimeofday(&start, NULL);
int * arr = new int[100000000];
@ironsmile
ironsmile / gist:1759915
Created February 7, 2012 14:23
distrustful function
<?php
// freakishly distrustful about its arguments function
function document_mark_as_sent($invoices){
global $page, $db;
if(empty($invoices)){ return; }
if(!is_array($invoices)){ $invoices = array((int)$invoices); }
if(!is_object($page) or !is_object($db)){ return; }
if(!isset($page->firm) or !$page->firm){ return; }
if( is_object($invoices[0]) ){ // значи е масив от Invoice обекти
$invoices = array_map(create_function('$i', 'return $i->id;'), $invoices);
#!/bin/sh
if [ $# -lt 1 ]
then
echo "Usage: $0 remote.host.name [port]"
exit 1
fi
REMHOST=$1
REMPORT=${2:-443}
@ironsmile
ironsmile / repeater.sh
Created September 9, 2013 13:34
repeats a command as long as its execution is more than 3 seconds
#!/bin/bash
while [[ true ]]; do
echo "[`date`] Repeating $1"
START=`date +%s`
$1
END=`date +%s`
DURATION=`echo "$END-$START" | bc`