Skip to content

Instantly share code, notes, and snippets.

Avatar

Aleksey Gureiev alg

View GitHub Profile
View main.c
void pwm_task(void *pvParameter) { DPORT_SET_PERI_REG_MASK(DPORT_PERIP_CLK_EN_REG, DPORT_LEDC_CLK_EN); DPORT_CLEAR_PERI_REG_MASK(DPORT_PERIP_RST_EN_REG, DPORT_LEDC_RST);
// 0 - 8MHz, 1 - 80 MHz
WRITE_PERI_REG(LEDC_CONF_REG, 1 << LEDC_APB_CLK_SEL_S);
// High speed
WRITE_PERI_REG(LEDC_HSTIMER0_CONF_REG, LEDC_TICK_SEL_HSTIMER0 | (0b000000001001010100 << LEDC_DIV_NUM_HSTIMER0_S) | (4 << LEDC_HSTIMER0_LIM_S));
// Low speed
WRITE_PERI_REG(LEDC_LSTIMER1_CONF_REG, (1 << LEDC_TICK_SEL_LSTIMER1_S) | (0b000000001001010100 << LEDC_DIV_NUM_LSTIMER1_S) | (4 << LEDC_LSTIMER1_LIM_S));
@alg
alg / metrics_test.exs
Last active Jul 30, 2018
ETS metrics
View metrics_test.exs
defmodule Metrics do
use GenServer
@type metric_pid :: pid()
@type server :: term()
@type time_tag :: :daily | :hourly | :minutely
@type metric :: {term(), term()}
View dets_test.exs
defmodule Server do
use Bitwise
require Record
Record.defrecord :server, id: nil, ip: nil, username: nil, password: nil
def from_id(id) do
ip = "127.#{band(id >>> 16, 0xff)}.#{band(id >>> 8, 0xff)}.#{band(id, 0xff)}"
server(id: id, ip: ip, username: "username_#{band(id, 0xff)}", password: "password")
end
View keybase.md

Keybase proof

I hereby claim:

  • I am alg on github.
  • I am spyromus (https://keybase.io/spyromus) on keybase.
  • I have a public key ASBCTumXp4eRSMQ3_aFMeBrhxMcsghCEX53_vdxLO5wUFgo

To claim this, I am signing this object:

@alg
alg / mycollectionview.swift
Created Aug 23, 2017
Invalidating item sizes with collection view resizing
View mycollectionview.swift
class MyCollectionView: NSCollectionView {
override var frame: NSRect {
didSet {
collectionViewLayout?.invalidateLayout()
}
}
}
View Main.elm
decodeModel : Json.Decode.Value -> Result String Model
decodeModel modelJson =
Json.Decode.decodeValue modelDecoder modelJson
modelDecoder : Json.Decode.Decoder Model
modelDecoder =
Json.Decode.map4 Model
(field "todos" (Json.Decode.list todoDecoder))
(field "todo" todoDecoder)
(field "filter" filterStateDecoder)
View resp.xml
<!-- Created experiment -->
<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tns="http://api.testbed.deterlab.net/xsd" xmlns:env="http://www.w3.org/2003/05/soap-envelope">
<env:Body>
<tns:createExperiment>
<tns:eid>Beta-Test:Test-Exp</tns:eid>
<tns:owner>spyromus</tns:owner>
<tns:accessLists>
<tns:circleId>Beta-Test:Beta-Test</tns:circleId>
View setup.yml
- request:
method: post
uri: https://spidev.isi.deterlab.net:52323/axis2/services/Experiments.ExperimentsHttpsSoap11Endpoint/
body:
encoding: UTF-8
string: <?xml version="1.0" encoding="UTF-8"?><env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tns="http://api.testbed.deterlab.net/xsd"
xmlns:env="http://www.w3.org/2003/05/soap-envelope"><env:Body><tns:addExperimentAspects><tns:eid>Alfa-Romeo:ExperimentOne</tns:eid><tns:aspects><tns:type>layout</tns:type><tns:data>PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiID8+CjxleHBlcmltZW50PgogPHZlcnNpb24+MS4wPC92ZXJzaW9uPgogPHN1YnN0cmF0ZXM+CiAgPG5hbWU+bGluazI8L25hbWU+CiAgPGNhcGFjaXR5PgogICA8cmF0ZT4xMDAwMDAuMDAwMDAwPC9yYXRlPgogICA8a2luZD5tYXg8L2tpbmQ+CiAgPC9jYXBhY2l0eT4KIDwvc3Vic3RyYXRlcz4KIDxzdWJzdHJhdGVzPgogIDxuYW1lPmxpbmswPC9uYW1lPgogIDxjYXBhY2l0eT4KICAgPHJhdGU+MTAwMDAwLjAwMDAwMDwvcmF0ZT4KICAgPGtpbmQ+bWF4PC9raW5kPgogIDwvY2FwYWNpdHk+CiA8L3N1YnN0cmF0ZXM+CiA8c3Vi
View a.rb
module M
def m
puts "module"
end
end
class A
def m
puts "class"
end
@alg
alg / remove_db_dump.rake
Created Apr 30, 2014
Remove db:structure:dump
View remove_db_dump.rake
# Place it in lib/tasks/
env = ENV['RACK_ENV'] || ENV['RAILS_ENV']
if env == 'production' || env == 'staging'
Rake::TaskManager.class_eval do
def remove_task(task_name)
@tasks.delete(task_name.to_s)
end
end
You can’t perform that action at this time.