I hereby claim:
- I am awnumar on github.
- I am awn (https://keybase.io/awn) on keybase.
- I have a public key ASAxDPmsYUiVNAyyrHP7IlqFN2Wfzik2-CEK5DatvHpqawo
To claim this, I am signing this object:
| // Copyright (c) 2025 Monzo Bank Limited | |
| // | |
| // Permission is hereby granted, free of charge, to any person obtaining a copy | |
| // of this software and associated documentation files (the "Software"), to deal | |
| // in the Software without restriction, including without limitation the rights | |
| // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
| // copies of the Software, and to permit persons to whom the Software is | |
| // furnished to do so, subject to the following conditions: | |
| // | |
| // The above copyright notice and this permission notice shall be included in all |
| package main | |
| import ( | |
| "encoding/base64" | |
| "flag" | |
| "fmt" | |
| "io/fs" | |
| "os" | |
| "path/filepath" | |
| "strings" |
I hereby claim:
To claim this, I am signing this object:
| /* | |
| * Copyright 2015-2016 Ben Ashford | |
| * | |
| * Licensed under the Apache License, Version 2.0 (the "License"); | |
| * you may not use this file except in compliance with the License. | |
| * You may obtain a copy of the License at | |
| * | |
| * http://www.apache.org/licenses/LICENSE-2.0 | |
| * | |
| * Unless required by applicable law or agreed to in writing, software |
| #!/usr/bin/python2 | |
| import hashlib | |
| from jinja2.sandbox import SandboxedEnvironment | |
| # We're using only the hashlib functions for demonstratin purposes | |
| # but any algorithm can be implemented and added to the program. | |
| # Define algorithms we support. |
| // Encode the length into raw binary. | |
| uint32_t rel_len = length; | |
| unsigned char len_bytes[4]; | |
| len_bytes[0] = (rel_len >> 24) & 0xFF; | |
| len_bytes[1] = (rel_len >> 16) & 0xFF; | |
| len_bytes[2] = (rel_len >> 8) & 0xFF; | |
| len_bytes[3] = rel_len & 0xFF; |
| package main | |
| import ( | |
| "fmt" | |
| "encoding/binary" | |
| ) | |
| func main() { | |
| // | |
| // Largest signed int64 in smallest byte slice. |
| package ptr2bytes | |
| func GetBytesFromPtr(ptr uintptr, len int, cap int) []byte { | |
| var sl = struct { | |
| addr uintptr | |
| len int | |
| cap int | |
| }{ptr, len, cap} | |
| return *(*[]byte)(unsafe.Pointer(&sl)) | |
| } |
| data := "xxx[...]xxx" | |
| var chunk []byte | |
| for i := 0; i < len(data); i += 1024 { | |
| if i+1024 > len(data) { | |
| // Remaining data <= 1024. | |
| chunk = data[len(data)-(len(data)%1024):] | |
| } else { | |
| // Split into chunks of 1024 bytes and pad. | |
| chunk = data[i:i+1024] |
I screwed up using git ("git checkout --" on the wrong file) and managed to delete the code I had just written... but it was still running in a process in a docker container. Here's how I got it back, using https://pypi.python.org/pypi/pyrasite/ and https://pypi.python.org/pypi/uncompyle6
apt-get update && apt-get install gdb