Skip to content

Instantly share code, notes, and snippets.

View DarrylDias's full-sized avatar
🎯
Focusing

Darryl Dias DarrylDias

🎯
Focusing
View GitHub Profile
@DarrylDias
DarrylDias / uptime.php
Created May 14, 2014 11:09
Display server uptime in PHP.
<?php
system("uptime");
?>
@DarrylDias
DarrylDias / pibang-zshrc
Created May 4, 2014 20:03
ZshRCfor PiBang Linux for Rasbperry Pi.
# Filename: /etc/zsh/zshrc
# Purpose: config file for zsh (z shell)
# Authors: grml-team (grml.org), (c) Michael Prokop <[email protected]>
# Bug-Reports: see http://grml.org/bugs/
# License: This file is licensed under the GPL v2.
################################################################################
# This file is sourced only for interactive shells. It
# should contain commands to set up aliases, functions,
# options, key bindings, etc.
#
@DarrylDias
DarrylDias / hello.php
Created May 1, 2014 11:19
Hello World in HackLang
/*
This is an example of Facebook's HackLang.
*/
<?hh # Hack uses 'hh' insted of 'php'
echo "Hello World!
@DarrylDias
DarrylDias / neovim-test.vim
Created April 26, 2014 16:06
Neovim job control demo Original file: http://pastebin.com/hpiCP9Ae
:let srv1_id = jobstart('netcat-server-1', 'nc', ['-l', '9991'])
:let srv2_id = jobstart('netcat-server-2', 'nc', ['-l', '9991'])
function JobEvent()
" v:job_data[0] = the job id
" v:job_data[1] = the event type, one of "stdout", "stderr" or "exit"
" v:job_data[2] = data read from stdout or stderr
if v:job_data[1] == 'stdout'
let str = 'Message from job '.v:job_data[0].': '.v:job_data[2]
elseif v:job_data[1] == 'stderr'
@DarrylDias
DarrylDias / .vimrc.local
Last active August 29, 2015 14:00
vimrc.local
colorscheme molokai
let g:neocomplcache_disable_auto_complete = 1
set nospell
inoremap <expr><TAB> pumvisible() ? "\<C-n>" : <SID>check_back_space() ? "\<TAB>" : "\<C-x>\<C-u>"
function! s:check_back_space()"{{{
let col = col('.') - 1
return !col || getline('.')[col - 1] =~ '\s'
@DarrylDias
DarrylDias / hello.rb
Created April 26, 2014 06:02
"Hello World!" in Sinatra framework.
require "sinatra/base"
class App < Sinatra::Base
get "/" do
"Hello World!"
end
end
@DarrylDias
DarrylDias / 256_Bit_bashrc
Created April 26, 2014 06:00
For Vim to enable 256 Bit color in Linux distributions like Ubuntu, Debian.
TERM=xterm-256color #
@DarrylDias
DarrylDias / phpversion.php
Created April 1, 2014 12:29
Display PHP version information.
<?php
echo PHP_VERSION;
?>
@DarrylDias
DarrylDias / pdodriver.php
Created March 28, 2014 17:32
Check for available drivers for Database in PDO PHP.
<?php
print_r(PDO::getAvailableDrivers()); // This will display an array that lists PDO drivers avilable on the web server.
?>
/*
Example.
Web Setup: WAMP.
var net = require('net'); // Store net module in net variable
var server = net.createServer(function (socket) { // create a netserver using createServer() function.
socket.write('Information \r\n'); // Write information of the client.
socket.pipe(socket); // connect to socket
});
server.listen(1337, '127.0.0.1'); // port and host running on.