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
defmodule Foo do | |
@directions %{north: {0, -1}, south: {0, 1}, east: {1, 0}, west: {-1, 0}} | |
def sampletext() 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
def allowed_step?(m, {x, y}) do | |
case m[{x, y}] do | |
:rock -> false | |
nil -> false | |
_ -> true | |
end | |
end | |
def get_next_steps({w,h,m} = map, {x0, y0} = curpos) 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
use nohash_hasher::IntMap; | |
//use std::sync::{Arc, Mutex}; | |
//use std::thread; | |
//use std::time::Instant; | |
//use once_cell::sync::Lazy; | |
//use once_cell::sync::OnceCell; | |
use std::cell::RefCell; | |
// our counters. | |
struct Counters { |
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
defmodule Echoserv do | |
@moduledoc """ | |
Documentation for `Echoserv`. | |
""" | |
require Logger | |
@port 9999 | |
def accept(port) 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
package main | |
import ( | |
"bufio" | |
"log" | |
"os" | |
//"fmt" | |
"unsafe" | |
) |
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 timeit | |
MAXITER, XDIM, YDIM = 500, 500, 500 | |
def mand(c): | |
it, z = 0, 0+0j | |
while it < MAXITER: | |
z = z*z + c | |
if abs(z) > 4.0: | |
break |
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
[Unit] | |
Description=dashd | |
After=network.target | |
OnFailure=mynotify@%n | |
[Service] | |
User=topi | |
Group=topi | |
Type=forking |
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
#!/usr/bin/python | |
# arg1 == path to devfile, like "/dev/bus/usb/bus_number/device_number" | |
import fcntl, sys, os | |
USBDEVFS_RESET = ord('U') << (4*2) | 20 | |
def main(): | |
fd = os.open(sys.argv[1], os.O_WRONLY) | |
if fd < 0: sys.exit(1) | |
fcntl.ioctl(fd, USBDEVFS_RESET, 0) | |
os.close(fd) |
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 file is part of systemd. | |
# | |
# systemd is free software; you can redistribute it and/or modify it | |
# under the terms of the GNU Lesser General Public License as published by | |
# the Free Software Foundation; either version 2.1 of the License, or | |
# (at your option) any later version. | |
# |
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
# Generated by iptables-save v1.6.0 on Wed Jul 26 07:00:26 2017 | |
*nat | |
:PREROUTING ACCEPT [0:0] | |
:INPUT ACCEPT [0:0] | |
:OUTPUT ACCEPT [0:0] | |
:POSTROUTING ACCEPT [0:0] | |
-A POSTROUTING -o eth0 -j MASQUERADE | |
COMMIT | |
# Completed on Wed Jul 26 07:00:26 2017 | |
# Generated by iptables-save v1.6.0 on Wed Jul 26 07:00:26 2017 |
NewerOlder