Skip to content

Instantly share code, notes, and snippets.

View brendanmckenzie's full-sized avatar

Brendan McKenzie brendanmckenzie

View GitHub Profile
package main
import (
"fmt"
"math"
)
func Sqrt(x float64) float64 {
z := float64(1)
last_z := z
using System;
using System.Collections.Generic;
using System.Linq;
public static class Program
{
public static void Main()
{
var names = new List<string> { "Alice", "Bob", "Charley", "Derp", "Ed", "F" };
[root@apacheserver ~]# fdisk -l
Disk /dev/sda: 107.4 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000d4bc7
Device Boot Start End Blocks Id System
<?php
if (isset($_POST['submit'])) {
$user = '...';
$pass = '...';
$dbh = new PDO('mysql:host=xxx;port=xxx;dbname=xxx', $user, $pass);
$stm = $dbh->prepare('insert into customer ( name, email, dob, last_updated ) values ( :name, :email, :dob, current_timestamp )');
$stm->bindParam(':name', $_POST['name']);
$stm->bindParam(':email', $_POST['email']);
int main(){for(int i=1;i++<=100;){printf("%s%s",i%3==0?"Fizz":"",i%5==0?"Buzz":"");printf(!((i%5==0)||(i%3==0))?"%d":"",i);printf("\n");}}
#include <stdio.h>
int main() {
int i;
for (i = 1; i <= 100; i++) {
if ((i % 3) == 0 && (i % 5) == 0) {
printf("FizzBuzz\n");
}
else if (i % 3 == 0) {
printf("Fizz\n");
public enum CidrGroup
{
Local,
Australia,
NewZealand
}
/// <summary>
/// Provides an easy interface for determining whether CIDR blocks contain specified IP addresses
/// </summary>
/// <remarks>
<?php
function buildResult() {
return array('result' => 'Joy to the world');
}
header('Content-type: application/json');
echo json_encode(buildResult());
import std.algorithm;
import std.array;
import std.csv;
import std.stdio;
import std.typecons;
import std.stream;
import std.path;
import std.string;
import std.file;
begin transaction;
create table "user" (
id serial not null
constraint pk_user primary key,
password bytea null,
created timestamp
);
create table "user_email" (