Skip to content

Instantly share code, notes, and snippets.

View DeMarko's full-sized avatar
🏠
Working from home

Dannel Jurado DeMarko

🏠
Working from home
View GitHub Profile
@DeMarko
DeMarko / sysinfo.pl
Created November 30, 2010 16:47
Quick and dirty script that displays some sysinfo that I wanted to see in my .login
#! /usr/bin/perl
use Shell qw(hostname date uptime users echo zwrite);
use Term::ANSIColor qw(:constants);
my $hostname = hostname;
chomp($hostname); # remove newline inserted by system command
@usersa = split(/\s/, users); # split users into an array
my $lncount = 80; # so the first line prints proper ^_^U
my $up = substr(uptime, 10); # display server uptime (the timestamp is a bit redudant I guess)
my $time = date; # remember where you're at in time
@DeMarko
DeMarko / blackjack.cpp
Created November 7, 2010 04:28
a blackjack program I wrote in C++, it's kind of awful
/**
* written by Dannel Jurado
* version: 03052009
*
* changelog 03052009: Welcome screen behavior, instead of just welcome screen
* changelog 03032009: submitted version
*/
#include <iostream>
#include <iomanip>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <iostream>
using namespace std;
char * remove_char_from_string(char *input_string, char given_char) {
char * newstring = (char *) calloc(strlen(input_string) + 1, sizeof(char));
@DeMarko
DeMarko / merge.cpp
Created November 7, 2010 03:13
quick example of a merge function in mostly-C C++
#include <iostream>
using namespace std;
int * Merge (int a[], int size_a, int b[], int size_b);
int main() {
int a[] = {1, 5, 8, 9, 13};
int b[] = {2, 6};
int * c = Merge(a, 5, b, 2);
#!/usr/bin/env ruby
# == Synopsis
# jsonpretty: a quick script for making JSON output legible
#
# == Usage
# jsonpretty [a JSON encoded file]
# [some stream with JSON text] | jsonpretty
#
# For this help use: jsonpretty -h
(* written by @chrisamaphone of chrisamaphone fame *)
val s_end = "\nval s_start = \"val s_end = \"\nfun quote #\"\\n\" = \"\\\\n\"\n\t| quote #\"\\\\\" = \"\\\\\\\\\"\n\t| quote c = Char.toString c\n\nfun q () = print (s_start ^ \"\\\"\" ^ (concat (map quote (explode s_end))) ^ \"\\\"\" ^ s_end)"
val s_start = "val s_end = "
fun quote #"\n" = "\\n"
| quote #"\\" = "\\\\"
| quote c = Char.toString c
fun q () = print (s_start ^ "\"" ^ (concat (map quote (explode s_end))) ^ "\"" ^ s_end)
# will highlight the term you are grepping for, works in bash and zsh
alias grep='GREP_COLOR="1;37;41" LANG=C grep --color=auto'