Skip to content

Instantly share code, notes, and snippets.

View Signum's full-sized avatar

Christoph Haas Signum

View GitHub Profile
@Signum
Signum / hackysolution.rb
Created February 20, 2023 19:58
Using Rack::Static in Hanami 2
# routes.rb:
```ruby
get '/api', to: ->(env) { [200, {}, ["A Rack compatible response"]] }
get '/*path', to: ::Imc::MyStatic.new("frontend/build")
```
# lib/imc/staticserve.rb:
```ruby
root@nb-chaas:~# rm /var/lib/dhcp/dhclient6.leases
rm: cannot remove '/var/lib/dhcp/dhclient6.leases': No such file or directory
root@nb-chaas:~# dhclient -6 -d wlan0
Internet Systems Consortium DHCP Client 4.3.5
Copyright 2004-2016 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
Listening on Socket/wlan0
Sending on Socket/wlan0
11 2017-02-27 16:01:26.368948 fe80::1f46:734:bdb2:9665 ff02::1:2 DHCPv6 Solicit XID: 0x1ceb9d CID: 000100012046fbc5843a4b93a140 118
Frame 11: 118 bytes on wire (944 bits), 118 bytes captured (944 bits)
Encapsulation type: Ethernet (1)
Arrival Time: Feb 27, 2017 16:01:26.368948000 CET
[Time shift for this packet: 0.000000000 seconds]
Epoch Time: 1488207686.368948000 seconds
[Time delta from previous captured frame: 0.111790000 seconds]
[Time delta from previous displayed frame: 0.000000000 seconds]
[Time since reference or first frame: 0.964107000 seconds]
root@gw:/var/dhcpd/etc # cat dhcpd
dhcpd.conf dhcpdv6.conf
root@gw:/var/dhcpd/etc # cat dhcpdv6.conf
option domain-name "home.workaround.org";
option ldap-server code 95 = text;
option domain-search-list code 119 = text;
default-lease-time 7200;
max-lease-time 86400;
log-facility local7;
$ LANG=C rdisc6 wlan0
Soliciting ff02::2 (ff02::2) on wlan0...
Hop limit : 64 ( 0x40)
Stateful address conf. : Yes
Stateful other conf. : Yes
Mobile home agent : No
Router preference : medium
Neighbor discovery proxy : No
Router lifetime : 1800 (0x00000708) seconds
Failed to execute the [velocity] macro. Click on this message for details.org.xwiki.rendering.macro.MacroExecutionException: Failed to evaluate Velocity Macro for content [#if ($xcontext.action == 'get')
#updateDocTreeConfigFromRequest
#handleDocumentTreeRequest
#end]
at org.xwiki.rendering.internal.macro.velocity.VelocityMacro.evaluateString(VelocityMacro.java:131)
at org.xwiki.rendering.internal.macro.velocity.VelocityMacro.evaluateString(VelocityMacro.java:50)
at org.xwiki.rendering.macro.script.AbstractScriptMacro.evaluateBlock(AbstractScriptMacro.java:286)
at org.xwiki.rendering.macro.script.AbstractScriptMacro.execute(AbstractScriptMacro.java:182)
at org.xwiki.rendering.macro.script.AbstractScriptMacro.execute(AbstractScriptMacro.java:58)
at org.xwiki.rendering.internal.transformation.macro.MacroTransformation.transform(MacroTransformation.java:269)
@Signum
Signum / gist:7695611
Created November 28, 2013 17:36
Trying to get phrase suggest ("did you mean") queries working
Example document:
{
_index: debshots
_type: jdbc
_id: 15808
_version: 172
_source: {
description: Children's game based on the "memory" card game
name: lmemory
@Signum
Signum / gist:5365778
Created April 11, 2013 18:12
Weird routing problem…
$ rake routes
domains GET /domains domains#index
POST /domains domains#create
new_domain GET /domains/new domains#new {:domain=>/[0-z\.\-]+/}
edit_domain GET /domains/:domain/edit domains#edit {:domain=>/[0-z\.\-]+/}
domain /domains/:domain(.:format) domains#show
PUT /domains/:domain domains#update {:domain=>/[0-z\.\-]+/}
DELETE /domains/:domain domains#destroy {:domain=>/[0-z\.\-]+/}
mailusers GET /domains/:domain/mailusers mailusers#index {:domain=>/[0-z\.\-]+/, :email=>/[0-z\.\-_@]+/}
POST /domains/:domain/mailusers mailusers#create {:domain=>/[0-z\.\-]+/, :email=>/[0-z\.\-_@]+/}
@Signum
Signum / gist:5042728
Created February 26, 2013 22:08
DB creation
chaas@aldi:~/projekte/ror/ispmailadmin$ rake db:drop
chaas@aldi:~/projekte/ror/ispmailadmin$ rake db:setup
-- create_table("domains", {:force=>true})
-> 0.0603s
-- create_table("mailaliases", {:force=>true})
-> 0.0423s
-- create_table("mailusers", {:force=>true})
-> 0.0274s
-- initialize_schema_migrations_table()
-> 0.0586s
@Signum
Signum / gist:5042709
Created February 26, 2013 22:06
First migration with different table name
class CreateMailusers < ActiveRecord::Migration
def change
create_table :virtual_users do |t|
t.string :email
t.string :password
t.timestamps
end
end
end