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 <bits/stdc++.h> | |
#include <lab.H> | |
using namespace std; | |
float calculateDistance(int x, int y) | |
{ | |
return sqrt(x*x + y*y); | |
} |
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
#pragma once | |
#include <atomic> | |
#include <algorithm> | |
#include "AlignAs.H" | |
/* | |
* 1. release-acquire memory order | |
* 2. false sharing and cache line | |
* 3. alignas | |
* |
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
def look_and_say(member): | |
while True: | |
num = [] | |
count = [] | |
pre = None | |
for ele in member: | |
if len(num) > 0 and pre == ele: | |
count[len(count)-1] += 1 | |
else: | |
num += [ele] |
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
// StlAlgo.cpp : Defines the entry point for the console application. | |
// | |
#include "stdafx.h" | |
#include <vector> | |
#include <array> | |
#include <algorithm> | |
#include <iterator> // ostream_iterator | |
#include <iostream> |
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 <iostream> | |
using namespace std; | |
// .data - read-write data | |
int rwdata = 100; | |
// .rodata - read-only data | |
const char* rodata = "hello, world"; |
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 strict; | |
my $targetPage = $ARGV[0]; #http://www.kingtoo.com/reg/whois.asp?domain=douban.com | |
print $targetPage . "\n"; | |
my @page = `curl $targetPage | iconv -f gb2312 -t utf8`; | |
chomp @page; | |
my $domainStatus; | |
for my $line (@page) | |
{ |
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
function printa(arr) | |
for _, v in ipairs(arr) do | |
io.write(v .. " ") | |
end | |
io.write("\n") | |
end | |
-- use consecutive number to represent the colors, like: | |
-- red: 1 |
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
LIBS = {} | |
DEPS = {} | |
EXPORTS = {'bar'} | |
bar = {} | |
function bar.use_nonpopular_bar() | |
print 'bar.use_nonpopular_bar' | |
end |
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
digraph | |
{ | |
subgraph cluster_solution | |
{ | |
label="solution" | |
App; | |
foo; | |
baz; | |
} | |
App -> foo; |
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
function consumer(prod) | |
while true do | |
local x = receive(prod) | |
print(x) | |
end | |
end | |
function receive(prod) | |
local status, value = coroutine.resume(prod) | |
return value |
NewerOlder