This file contains hidden or 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
/* | |
surround a binary operator (particular a low precedence | |
one) with spaces; don't try to write the most compact | |
code possible but rather the most readable. | |
*/ | |
int i = 5 + 3; | |
//NOT | |
int i=5+3; | |
/* |
This file contains hidden or 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
void xor(char *str, char *key) { | |
char *t=key; | |
for (;*str;str++,t++){ | |
if(!*t){t=key;} | |
*str^=*t;}} |
This file contains hidden or 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
syn match goMember "\.\zs\w\+\ze\%((\@!\W\)" | |
syn match goMethod "\.\zs\w\+\ze(" | |
hi def link goMember Identifier | |
hi def link goMethod Function |
This file contains hidden or 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
//In this example i assume that 'T' is an int | |
func DoWhatever(toSay string, c chan int) { | |
for { | |
n := <-c | |
fmt.Printf('%s %d\n', toSay, n) | |
} | |
} | |
func main() { |
This file contains hidden or 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
package main | |
import ( | |
"fmt" | |
"runtime" | |
"image" | |
"image/color" | |
"image/png" | |
"math" | |
"os" |
This file contains hidden or 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
package main | |
import ( | |
"fmt" | |
"os" | |
) | |
type FuzzMatch struct { | |
str string | |
val int |
This file contains hidden or 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
package main | |
import ( | |
"net" | |
"gob" | |
"os" | |
"bytes" | |
) | |
const ( |
This file contains hidden or 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
package main | |
import ( | |
"net" | |
"time" | |
) | |
func main() { | |
time.Sleep(time.Second) | |
addr,err := net.ResolveUDPAddr("udp", "192.168.1.10:6112") |
This file contains hidden or 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 <utility> | |
#define __NO_STD_VECTOR | |
#include <CL/cl.hpp> | |
#include <cstdio> | |
#include <cstdlib> | |
#include <iostream> | |
#include <string> | |
#include <iterator> | |
#include <fstream> |
This file contains hidden or 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 <math.h> | |
inline | |
int isPrime(int check, int *primes) { | |
for (; (*primes * *primes) < check; primes++) | |
if (check % *primes == 0) return 0; | |
return 1; | |
} |