This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
me: | |
@true | |
a: | |
@true | |
sandwich: | |
@[ "$$(id -u)" -eq 0 ] && echo "Okay." || echo "What? Make it yourself." | |
.PHONY: me a sandwich |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Main where | |
fizzBuzz :: Int -> String | |
fizzBuzz n | |
| mod n 15 == 0 = "FizzBuzz" | |
| mod n 3 == 0 = "Fizz" | |
| mod n 5 == 0 = "Buzz" | |
| otherwise = show n | |
main = do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Undead { | |
~Undead()=delete; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <unistd.h> | |
#ifdef __GLIBC__ | |
#if !(__GLIBC_PREREQ(2, 7)) | |
#error %m is not available | |
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# get all ipv4 addresses of existing connections | |
ip -4 -oneline a | awk '{ print $2 ": " $4 }' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
this is a sample of output: | |
root@percona-db-2:~# iperf -s -u -B 226.94.1.1 -i 1 | |
------------------------------------------------------------ | |
Server listening on UDP port 5001 | |
Binding to local address 226.94.1.1 | |
Joining multicast group 226.94.1.1 | |
Receiving 1470 byte datagrams | |
UDP buffer size: 122 KByte (default) | |
------------------------------------------------------------ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::str::FromStr; | |
#[derive(Debug)] | |
enum Version { Version1, Version2 } | |
#[derive(Debug)] | |
enum ParseError { InvalidSyntax, UnsupportedVersion } | |
fn parse_version(line: String) -> Result<Version, ParseError> { | |
let mut split = line.split("="); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::str::FromStr; | |
#[derive(Debug)] | |
enum Version { Version1, Version2 } | |
#[derive(Debug)] | |
enum ParseError { InvalidSyntax, UnsupportedVersion } | |
struct NameValue { | |
name: String, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DigitCounter { | |
public static int getCountsOfDigits(int n) | |
{ | |
if (n > 999999999) | |
return 10; | |
if (n > 99999999) | |
return 9; | |
if (n > 9999999) | |
return 8; | |
if (n > 999999) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
#define unlikely_custom(p) (!!(p)) | |
char* f() { | |
char *ppsz_ret; | |
ppsz_ret = malloc(sizeof(char *) * 12); | |
if (! ! (!ppsz_ret)) | |
return NULL; |
OlderNewer