Skip to content

Instantly share code, notes, and snippets.

@Nopik
Nopik / main.c
Created September 13, 2018 16:27
nRF52840 crash on FreeRTOS
/**
* Copyright (c) 2017 - 2018, Nordic Semiconductor ASA
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
@Nopik
Nopik / main.c
Created September 26, 2018 12:28
nRF52840 crash
/**
* Copyright (c) 2017 - 2018, Nordic Semiconductor ASA
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
@Nopik
Nopik / example.coffee
Created January 23, 2014 11:08
Ember patterns for custom models
#having Foo object, get some item:
item = foo.get( 'items' ).getBy( 'name', 'item1' )
#Feed this item to the view.
#if item is not loaded yet, is has isLoaded = false,
#so you can easily {{#if item.isLoaded}} {{item.name}} {{else}} Please wait, loading {{/if}} in your view
#you can load the item later on. Once deserialize will be called on foo, it will take care to fill in the item1 properties
@Nopik
Nopik / convert.sh
Last active December 21, 2015 10:28
awsm.json to s-function.json
#!/bin/bash
# Name of your lambda
FN=foo
# Absolute path to some s-function file which will be used as template
TEMPLATE=/absolute/path/to/some/s-function.json
jq ".[0].functions.$FN.handler=(.[1].lambda.cloudFormation.Handler | sub(\"aws_\";\"\"))|.[0].functions.$FN.timeout=.[1].lambda.cloudFormation.Timeout|.[0].functions.$FN.memorySize=.[1].lambda.cloudFormation.MemorySize|.[0].functions.$FN.endpoints[0].path=.[1].apiGateway.cloudFormation.Path|.[0].functions.$FN.endpoints[0].method=.[1].apiGateway.cloudFormation.Method|.[0].functions.$FN.endpoints[0].requestParameters=.[1].apiGateway.cloudFormation.RequestParameters|.[0].functions.$FN.endpoints[0].requestTemplates=.[1].apiGateway.cloudFormation.RequestTemplates|.[0].functions.$FN.endpoints[0].responses=.[1].apiGateway.cloudFormation.Responses|.[0]" --slurp $TEMPLATE awsm.json >s-function.json
git add s-function.json
@Nopik
Nopik / restler.js
Last active December 14, 2015 21:28
This program (using restler 2.0.1):
restler = require( 'restler' );
r1 = restler.get( 'http://localhost:90/undefined-1', {} )
r1.on( 'error', function(){ console.log( "R1 Error" ); } )
r1.on( 'complete', function(){ console.log( "R1 Complete" ); } )
r2 = restler.get( 'http://localhost:90/undefined-2', {} )
r2.on( 'error', function(){ console.log( "R2 Error" ); } )
// Version: v1.0.0-pre.2-397-gd269fa3
// Last commit: d269fa3 (2013-01-14 21:31:22 -0800)
(function() {
/*global __fail__*/
/**
Ember Debug
@Nopik
Nopik / gist:4484175
Last active December 10, 2015 19:48
In controller:
App.DashboardController = Ember.Controller.extend
workspaces: []
currentWorkspace: null //set by /workspace/:id route
fetch: ->
//ajax load workspaces
input {
file {
path => "/Users/nopik/Warsztat/logstash/redis.log"
type => "r"
start_position=>"beginning"
}
}
filter {
grok {
5477 22:34:04 NopiMac ~/Warsztat/logstash$ java -jar logstash-1.1.1-monolithic.jar agent -f hello-search.conf -- web --backend 'elasticsearch:///?local'
Exception in thread "LogStash::Runner" org.jruby.exceptions.RaiseException: (LoadError) Unable to activate ftw-0.0.19, because json-1.7.5 conflicts with json (= 1.6.5)
at Specification.raise_if_conflicts(file:/Users/nopik/Documents/Projects/logstash/logstash-1.1.1-monolithic.jar!/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems/specification.rb:1637)
at Specification.activate(file:/Users/nopik/Documents/Projects/logstash/logstash-1.1.1-monolithic.jar!/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems/specification.rb:746)
at (Anonymous).try_activate(file:/Users/nopik/Documents/Projects/logstash/logstash-1.1.1-monolithic.jar!/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems.rb:212)
at Kernel.require(file:/Users/nopik/Documents/Projects/logstash/logstash-1.1.1-monolithic.jar!/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:59)
@Nopik
Nopik / application.js.hamlbars
Created September 1, 2012 09:30
Named outlets in Ember views
.navbar.navbar-fixed-top
%ul.dropdown-menu
%li.nav-header
Projects
%li.divider
{{outlet projectNames}}
%li.divider