Skip to content

Instantly share code, notes, and snippets.

View brurucy's full-sized avatar
🎯
Focusing

Bruno Rucy Carneiro Alves de Lima brurucy

🎯
Focusing
View GitHub Profile
@brurucy
brurucy / testing
Created March 25, 2021 20:42
test
gist
@brurucy
brurucy / testib.zig
Created March 27, 2021 11:39
testing_again
pub fn {
buzzfizz
}
@brurucy
brurucy / gost.coq
Created March 27, 2021 14:25
geest
Qed.
@brurucy
brurucy / gust.coq
Created March 27, 2021 15:42
ghost
Qed.
@brurucy
brurucy / dora.js
Last active June 30, 2022 10:59
dora-snippet-example
module.exports = async function (config) {
try {
// Negative Lookahead on comments line
const key = `^(?!#)${config.param}`;
// Get Base image from Dockerfile.CI
const dockerfileCIResults = await findStringByKey(config, key);
const dockerFileConfig = { path: 'Dockerfile', param: config.param };
const dockerfileResults = await findStringByKey(dockerFileConfig, key);
if (dockerfileCIResults.length > 0) {
// Compare the last FROM ocurrency for both files
@brurucy
brurucy / neodora.rego
Created June 30, 2022 11:01
rego-snippet-example
imageDefinition[result] {
data.neodora.files["go.mod"] == null
ciImage := last_image_from_file(input)
normalImage := trim_suffix(last_image_from_file(data.neodora.files.Dockerfile), "-dev")
ciImage != normalImage
result = {
"ciImage": ciImage,
"normalImage": normalImage,
}
}
@brurucy
brurucy / neodora-test.rego
Created June 30, 2022 11:06
neodora-test-snippet-example
test_deny_different_images {
imageDefinition[{
"ciImage": "node:14-alpine",
"normalImage": "php:16-alpine",
}] with input as [[{
"Cmd": "from",
"Flags": [],
"JSON": false,
"Stage": 0,
"SubCmd": "",
@brurucy
brurucy / example_1.go
Created February 9, 2023 21:19
memoir
type Obj struct {
foo int
bar string
}
func (o *Obj) ToString() string {
return fmt.Sprintf(“obj: %d %s”, o.foo, o.bar)
}
@brurucy
brurucy / example_2.go
Created February 9, 2023 21:20
memoir
type Option func(*Obj)
func Foo(foo int) Option {
return func(obj *Obj) {
obj.foo = foo
}
}
func Bar(bar string) Option {
return func(obj *Obj) {
@brurucy
brurucy / example_3.go
Created February 9, 2023 21:21
memoir
func New(opts …Option) *Obj {
obj := new(Obj)
for _, opt := range opts {
opt(obj)
}
return obj
}