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
func (app *App) describeInstances(id string, name string) ([]Node, error) { | |
svc := ec2.New(app.cfg) | |
input := &ec2.DescribeInstancesInput{ | |
InstanceIds: []string{id}, | |
Filters: []ec2.Filter{ | |
{ | |
Name: aws.String("tag:Name"), | |
Values: []string{name}, | |
}, | |
}, |
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
net.core.wmem_max = 8388608 | |
net.core.rmem_max = 8388608 | |
net.ipv4.tcp_rmem = 4096 87380 8388608 | |
net.ipv4.tcp_low_latency = 1 | |
# Tcp congestion protocol | |
net.ipv4.tcp_congestion_control=yeah |
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
<?php | |
$tarantool = new Tarantool('localhost'); | |
$tarantool->upsert("server",array(1,0,0,0), | |
array ( | |
array( | |
"field" => 2, | |
"op" => "+", | |
"arg" => 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
pub fn lpv(iter_num: usize, sz: usize) -> usize { | |
let sums: Vec<_> = (0..iter_num) | |
.map(|_| { | |
let x: Vec<_> = (0..sz).map(|i| i).collect(); | |
let y: Vec<_> = x.iter().zip(x.iter().skip(1)).map(|(x, y)| x + y).collect(); | |
(0..sz).step_by(100).map(|i| y[i]).sum() | |
}) | |
.collect(); | |
*sums.last().unwrap() | |
} |
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
package main | |
import "fmt" | |
func main() { | |
var sum int64 | |
var i int64 | |
for e := 0; e < 20; e++ { | |
sum = 0 |
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
package main | |
import ( | |
"fmt" | |
"math/rand" | |
) | |
func main() { | |
var set = make(map[int]bool) |
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
// Simple demonstration of HashMap. | |
import java.util.*; | |
public class Test { | |
public static void main(String[] args) { | |
Random rand = new Random(47); | |
Map<Integer,Boolean> m = | |
new HashMap<Integer,Boolean>(); | |
for(int i = 0; i < 1000000000; i++) { | |
m.put(rand.nextInt(30),Boolean.TRUE); |
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
import java.util.*; | |
public class SetOfInteger { | |
public static void main(String[] args) { | |
Random rand = new Random(47); | |
Set<Integer> intset = new HashSet<Integer>(); | |
for(int i = 0; i < 1000000000; i++) | |
intset.add(rand.nextInt(30)); | |
System.out.println(intset); | |
} |
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
//: interfaces/AdaptedRandomDoubles.java | |
// Creating an adapter with inheritance. | |
import java.nio.*; | |
import java.util.*; | |
public class AdaptedRandomDoubles extends RandomDoubles implements Readable { | |
private int count; | |
public AdaptedRandomDoubles(int count) { | |
this.count = count; | |
} |