Skip to content

Instantly share code, notes, and snippets.

$ irb
irb(main):001:0> require 'yaml'
=> true
irb(main):002:0> YAML::load_file 'test.yaml'
=> {"foo"=>"bar"}
irb(main):003:0> ^D
$ python
Python 3.6.5 (default, Apr 25 2018, 14:23:58)
[GCC 4.2.1 Compatible Apple LLVM 9.1.0 (clang-902.0.39.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
// cryptopals 1.6
package main
import (
"os"
"fmt"
"encoding/base64"
"math"
"strings"
"io/ioutil"
package main
import (
"fmt"
"encoding/hex"
"strings"
)
func main () {
def getjson
thejson = ''
uri = URI.parse("http://#{@dump1090host}:#{@dump1090port}/data.json")
begin
Timeout::timeout(1) {
thejson = Net::HTTP.get(uri) rescue {}
}
rescue Timeout::Error => e
log 'Getting the JSON timed out'
log e.message
Nov 4 11:21:52 raspberrypi noisemon: {"hex"=>"70604e", "flight"=>"KAC104 ", "lat"=>51.453956, "lon"=>-0.534058, "altitude"=>2400, "track"=>227, "speed"=>167, :distance=>2.5128381354906066}
Nov 4 11:21:53 raspberrypi noisemon: {"hex"=>"70604e", "flight"=>"KAC104 ", "lat"=>51.452326, "lon"=>-0.536804, "altitude"=>2425, "track"=>227, "speed"=>167, :distance=>2.5436887611907655}
Nov 4 11:21:54 raspberrypi noisemon: {"hex"=>"70604e", "flight"=>"KAC104 ", "lat"=>51.451721, "lon"=>-0.537796, "altitude"=>2425, "track"=>227, "speed"=>170, :distance=>2.5582822086619865}
Nov 4 11:21:55 raspberrypi noisemon: {"hex"=>"70604e", "flight"=>"KAC104 ", "lat"=>51.45108, "lon"=>-0.53885, "altitude"=>2450, "track"=>226, "speed"=>173, :distance=>2.575109039354822}
Nov 4 11:21:56 raspberrypi noisemon: {"hex"=>"70604e", "flight"=>"KAC104 ", "lat"=>51.450211, "lon"=>-0.540112, "altitude"=>2475, "track"=>226, "speed"=>175, :distance=>2.603431262425656}
Nov 4 11:21:57 raspberrypi noisemon: {"hex"=>"70604e", "flight"=>"KAC104
irb(main):002:0> require 'time'
=> true
irb(main):003:0> foo = Time.parse(Time.now.iso8601(6))
=> Thu Dec 10 16:30:00 +0000 2015
irb(main):004:0> {1=> foo}.to_yaml
=> "--- \n1: 2015-12-10 16:30:00.669659 +00:00\n"
irb(main):005:0> ^Dspenceware:~ fids$ irb
spenceware:~ fids$
spenceware:~ fids$ 200
spenceware:~ fids$ irb
foo = JSON::load File.read '3.8.4.catalog.json'
bar = {}
bar = foo['data']
bar['metadata'] = foo['metadata']
bar['document_type'] = foo['document_type']
File.open('munge.json','w') {|f| f.write bar.to_json }
<configuration scan="true">
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d %-5p [%c{2}] %m%n</pattern>
</encoder>
</appender>
<appender name="F1" class="ch.qos.logback.core.FileAppender">
<!-- TODO: this path should not be hard-coded -->
<file>/var/log/puppetlabs/puppetserver/puppetserver.log</file>

Thank you.

Before I start my speech, I want to say a few words about the heart-breaking events that unfolded in Paris on Friday evening.

This was an assault not just on the people of France, but on all of us who value freedom and democracy. We stand with the people of France. We know that we must act as one, just as our enemies see us as one.

As David Cameron has said, we will do everything we possibly can to help the French at this moment of national trauma. That includes making available to them the sharpest of our own national capability, which includes the skills and capabilities of GCHQ.

Before the dreadful events of the weekend we had already indicated that we would be increasing substantially the resources we dedicate to countering the terrorist threat posed by ISIL.

Puppet::PreformattedError:
Evaluation Error: Error while evaluating a Function Call, function 'regsubst' called with mis-matched arguments
expected one of:
regsubst(Variant[Array[String], String] target, String pattern, String replacement, Optional[Pattern[/^[GEIM]*$/]] flags?, Enum['N', 'E', 'S', 'U'] encoding?) - arg count {3,5}
regsubst(Variant[Array[String], String] target, Variant[Regexp, Type[Regexp]] pattern, String replacement, Pattern[/^G?$/] flags?) - arg count {3,4}
actual:
regsubst(Undef, String, String, String) - arg count {4} at... on node spenceware