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
| def make_incrementors(start, amounts): | |
| y = [start] | |
| results = [] | |
| for x in amounts: | |
| def add_x(): | |
| y[0] += x | |
| return y[0] | |
| results.append(add_x) | |
| return results |
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
| def make_incrementors(start, amounts): | |
| y = [start] | |
| results = [] | |
| for x in amounts: | |
| def add_x(): | |
| y[0] += x | |
| return y[0] | |
| results.append(add_x) | |
| return results |
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
| def make_adder(x): | |
| def add_x(y): | |
| return x + y | |
| return add_x |
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
| module solve_ida | |
| implicit none | |
| integer*8 :: neq = 4 | |
| integer*8 :: iout(25) | |
| real*8 :: rout(10) | |
| real*8 :: y0(4), yp0(4) | |
| real*8 :: diff(4), mas(4, 4) | |
| real*8 :: jac(4, 4) |
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 <stdint.h> | |
| #include <unistd.h> | |
| struct atom { | |
| double pos[3]; | |
| uint8_t symbol[2]; | |
| }; | |
| void 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
| #include <stdio.h> | |
| #include <errno.h> | |
| #include <unistd.h> | |
| extern int errno; | |
| int main() | |
| { | |
| FILE *fp; | |
| fp = fopen("test_file", "w+"); |
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
| tcpdump: listening on eth0, link-type EN10MB (Ethernet), capture size 262144 bytes | |
| 18:58:18.250459 IP6 (hlim 255, next-header ICMPv6 (58) payload length: 112) fe80::6e72:20ff:fe3e:7ca4 > ff02::1: [icmp6 sum ok] ICMP6, router advertisement, length 112 | |
| hop limit 64, Flags [none], pref medium, router lifetime 30s, reachable time 0s, retrans time 0s | |
| prefix info option (3), length 32 (4): 2602:100:689f:d812::/64, Flags [onlink, auto], valid time 86400s, pref. time 86400s | |
| 0x0000: 40c0 0001 5180 0001 5180 0000 0000 2602 | |
| 0x0010: 0100 689f d812 0000 0000 0000 0000 | |
| rdnss option (25), length 24 (3): lifetime 10s, addr: 2607:f428:1::5353:1 | |
| 0x0000: 0000 0000 000a 2607 f428 0001 0000 0000 | |
| 0x0010: 0000 5353 0001 | |
| rdnss option (25), length 24 (3): lifetime 10s, addr: 2607:f428:2::5353:1 |
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
| tcpdump: listening on eth0, link-type EN10MB (Ethernet), capture size 262144 bytes | |
| 18:55:44.750146 IP6 (hlim 255, next-header ICMPv6 (58) payload length: 112) fe80::6e72:20ff:fe3e:7ca4 > ff02::1: [icmp6 sum ok] ICMP6, router advertisement, length 112 | |
| hop limit 64, Flags [none], pref medium, router lifetime 30s, reachable time 0s, retrans time 0s | |
| prefix info option (3), length 32 (4): 2602:100:689f:d812::/64, Flags [onlink, auto], valid time 86400s, pref. time 86400s | |
| 0x0000: 40c0 0001 5180 0001 5180 0000 0000 2602 | |
| 0x0010: 0100 689f d812 0000 0000 0000 0000 | |
| rdnss option (25), length 24 (3): lifetime 10s, addr: 2607:f428:1::5353:1 | |
| 0x0000: 0000 0000 000a 2607 f428 0001 0000 0000 | |
| 0x0010: 0000 5353 0001 | |
| rdnss option (25), length 24 (3): lifetime 10s, addr: 2607:f428:2::5353:1 |
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
| struct Atom { | |
| position: [f32; 3], | |
| epsilon: f32, | |
| sigma: f32, | |
| } | |
| impl Atom { | |
| fn new(x: f32, y: f32, z: f32, epsilon: f32, sigma: f32) -> Atom { | |
| Atom { | |
| position: [x, y, z], |
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
| if block: | |
| call_viewer(command, filename) | |
| else: | |
| p = multiprocessing.Process(target=call_viewer, args=(command, filename)) | |
| p.start() | |
| def call_viewer(command, filename): | |
| subprocess.call([command, filename]) | |
| os.remove(filename) |