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 RubyServer do | |
use GenServer | |
def start_link(opts \\ []) do | |
GenServer.start_link(__MODULE__, nil, opts) | |
end | |
def cast(server, cmd) do | |
GenServer.cast(server, {:cast, cmd}) | |
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
First install pip for Python2. Download the get-pip.py file from https://bootstrap.pypa.io/get-pip.py | |
$ cd <download location> | |
$ sudo -H python ./get-pip.py | |
Installing pip also installs Python3 | |
To run Python3 | |
$ python3 | |
Install pip3 by just executing the same file as in the step above, but this time using Python3 | |
$ sudo -H python3 ./get-pip.py |
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
# | |
# INPUT - Logstash listens on port 8514 for these logs. | |
# | |
input { | |
udp { | |
port => "8514" | |
type => "syslog-cisco" | |
} | |
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
""" | |
Logical deletion for Django models. Uses is_void flag | |
to hide discarded items from queries. Overrides delete | |
methods to set flag and soft-delete instead of removing | |
rows from the database. | |
""" | |
from django.apps import apps | |
from django.contrib.admin.utils import NestedObjects | |
from django.db import models | |
from django.db.models import signals |
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 DateTimeGenerators do | |
use ExUnitProperties | |
@time_zones ["Etc/UTC"] | |
def date do | |
gen all year <- integer(1970..2050), | |
month <- integer(1..12), | |
day <- integer(1..31), | |
match?({:ok, _}, Date.from_erl({year, month, day})) 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 sample | |
import kotlinx.cinterop.* | |
import platform.windows.* | |
@ExperimentalUnsignedTypes | |
fun WndProc(hwnd: HWND?, msg: UINT, wParam: WPARAM, lParam: LPARAM) : LRESULT | |
{ | |
// This switch block differentiates between the message type that could have been received. If you want to | |
// handle a specific type of message in your application, just define it in this block. |