Skip to content

Instantly share code, notes, and snippets.

View d-led's full-sized avatar

Dmitry Ledentsov d-led

View GitHub Profile
use "promises"
use "time"
actor Main
let _env: Env
var _count: U64 = 0
new create(env: Env) =>
_env = env
defmodule Spin do
use GenServer
def start_link(_ \\ []) do
GenServer.start_link(__MODULE__, :ok, [])
end
def init(_) do
schedule()
{:ok, []}
package main
import (
"fmt"
"runtime"
"time"
)
func main() {
go tick()
input = [
%{:a => %{ :b => %{ :c => :x } }, :name => "Moo" } ,
%{:a => %{ :b => %{ :c => :y } }, :name => "Mah" } ,
%{:a => %{ :b => %{ :c => :x } }, :name => "Mee" } ,
%{:foo => :bar}
]
# search for those where e[a.b.c] == :x and give their names
input
// ==UserScript==
// @name GoCD artifact directory download as Zip
// @namespace https://ledentsov.de
// @version 0.1
// @description download gocd artifacts as zip
// @author DLed
// @match https://*:8154/go/tab/build/detail/*/*/*/*/*
// @require https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js
// @grant GM_addStyle
// ==/UserScript==
package main
// Output:
// Config file: C:\Users\<username>\test.toml
// Viper: open C:\Users\<username>\test.toml: The system cannot find the file specified.
// Old credentials: &{ServerURL:https://example.com Username:testuser Secret:1wdw1}
// Enter password: ******
// New credentials: {ServerURL:https://example.com Username:testuser Secret:blabla}
import (
# executable online at https://www.tutorialspoint.com/execute_elixir_online.php
ExUnit.start()
defmodule Diamond do
def of(char) do
0..line_count(char) - 1
|> Enum.to_list
|> Enum.map(fn(pos) -> line(pos, char) end)
end
@d-led
d-led / application.ex
Last active August 10, 2017 07:30
a simple web service in Elixir, returning :erlang.unique_integer
#mix new rest_unique --sup
#mix deps.compile && mix deps.get
#iex -S mix
#hey -n 200000 http://localhost:4444/
defmodule RestUnique.Application do
@moduledoc false
use Application
def start(_type, _args) do
@d-led
d-led / csv.exs
Last active March 29, 2017 13:09
demo_lines = ["col 0,col 1,col 2\n", "542,414,26\n", "335,950,113\n", "378,954,231"]
csv_stats = fn lines ->
lines
|> Stream.drop(1)
|> Stream.with_index
|> Stream.map(fn {value, index} ->
{
value
|> String.trim
using System;
using System.Linq;
using System.IO;
using System.Collections.Generic;
namespace cs_console
{
class CsvStats
{