Skip to content

Instantly share code, notes, and snippets.

View aerosol's full-sized avatar
🌞
Praise the sun

hq1 aerosol

🌞
Praise the sun
View GitHub Profile
adam@minigun /Volumes/ramdisk/ubic [gh-airos-141-device-to-cloud-api+*]
$ bin/python utils/python/eeprom_mig/migrate.py ubic_device_eepromsha ubic_device_eepromsha2
ubic_device_eepromsha ubic_device_eepromsha2
All 42 objects were migrated. Buckets consistency was not checked!
adam@minigun /Volumes/ramdisk/ubic [gh-airos-141-device-to-cloud-api+*]
$ bin/python utils/python/eeprom_mig/migrate.py ubic_device_eepromsha2 ubic_device_eepromsha
ubic_device_eepromsha2 ubic_device_eepromsha
All 0 objects were migrated. Buckets consistency was not checked!
@aerosol
aerosol / t.py
Created May 14, 2014 19:25 — forked from AeroNotix/t.py
def random_device(reuse_owner=False, **kwds):
def wrapper(f):
def wrapped(self):
if reuse_owner and hasattr(self, 'device'):
print "Reusing owner %s" % self.device
d = self.device
else:
print "no owner"
d = 'A NEW DEVICE'
self.device = d
{:user {:plugins [[cider/cider-nrepl "0.8.1"]
[lein-cljfmt "0.1.7"]
[cljfmt "0.1.7"]]}}
1)
wireless.connections.ap = [{some_ap, live:false},
{new_ap, live:true}]
2)
wireless.connections.ap = [{some_ap, live:true}]
3)
;;; packages.el --- hq1-elm Layer packages File for Spacemacs
;;
;; Copyright (c) 2012-2014 Sylvain Benner
;; Copyright (c) 2014-2015 Sylvain Benner & Contributors
;;
;; Author: Sylvain Benner <sylvain.benner@gmail.com>
;; URL: https://github.com/syl20bnr/spacemacs
;;
;; This file is not part of GNU Emacs.
;;
defmodule Xbp do
@moduledoc ~S"""
Dumps binaries in a similar way to xxd
"""
import Enum, only: [chunk: 4, join: 2, map: 2, with_index: 1, zip: 2]
@chunk_len 16
@offset_len 8
user=> (reduce + (map (constantly 1) [:hello :cruel :world]))
3
iex(34)> Repo.get_by(APIKey, key: "7488a646-e31f-11e4-aace-600308960662")
%Foo.APIKey{__meta__: #Ecto.Schema.Metadata<:loaded>,
account: #Ecto.Association.NotLoaded<association :account is not loaded>,
account_id: 41, id: 13, inserted_at: #Ecto.DateTime<2015-08-18T15:45:31Z>,
key: "7488a646-e31f-11e4-aace-600308960662",
updated_at: #Ecto.DateTime<2015-08-18T15:45:31Z>}
iex(35)> q = from a in Account,
...(35)> join: k in APIKey, on: a.id == k.account_id,
...(35)> where: k.key == "7488a646-e31f-11e4-aace-600308960662",
...(35)> select: {a.id, a.name}
iex(48)> Repo.one(from a in APIKey, where: a.key == "7488a646-e31f-11e4-aace-600308960662")
** (Postgrex.Error) ERROR (character_not_in_repertoire): invalid byte sequence for encoding "UTF8": 0x88
(ecto) lib/ecto/adapters/sql.ex:171: Ecto.Adapters.SQL.query!/5
(ecto) lib/ecto/adapters/sql.ex:464: Ecto.Adapters.SQL.execute/6
(ecto) lib/ecto/repo/queryable.ex:95: Ecto.Repo.Queryable.execute/5
(ecto) lib/ecto/repo/queryable.ex:15: Ecto.Repo.Queryable.all/4
(ecto) lib/ecto/repo/queryable.ex:44: Ecto.Repo.Queryable.one/4
iex(48)> Repo.one(from a in APIKey, where: a.key == ^kkk)
%Foo.APIKey{__meta__: #Ecto.Schema.Metadata<:loaded>,
account: #Ecto.Association.NotLoaded<association :account is not loaded>,
defmodule Foo do
def f(x), do: &(x + &1)
def f(x, y), do: x - y
end
3 |> Foo.f(2)