Skip to content

Instantly share code, notes, and snippets.

View kwilczynski's full-sized avatar
🐧
Have you built a Linux kernel recently?

Krzysztof Wilczyński kwilczynski

🐧
Have you built a Linux kernel recently?
  • Yokohama, Japan
  • 04:44 (UTC +09:00)
View GitHub Profile
diff --git i/include/linux/sysfs.h w/include/linux/sysfs.h
index d76a1ddf83a3..9a3dd616881a 100644
--- i/include/linux/sysfs.h
+++ w/include/linux/sysfs.h
@@ -205,6 +205,13 @@ struct bin_attribute {
.size = _size, \
}
+#define __BIN_ATTR_RO_MODE(_name, _mode, _size) { \
+ .attr = { .name = __stringify(_name), \
@kwilczynski
kwilczynski / gist:6a4b5a20869c1bc9a67ac368516531f6
Created February 27, 2021 23:42
Sarama enable TLS - Kafka in Go
config := sarama.NewConfig()
config.Net.SASL.Enable = true
config.Net.SASL.User = "bob"
config.Net.SASL.Password = "builder123"
config.Net.TLS.Enable = true
tlsConfig := &tls.Config{
InsecureSkipVerify: false,
PreferServerCipherSuites: true,
function packet() {
local now=$(date -u '+%a, %d %h %Y %H:%M:%S GMT')
local url="${PACKET_URL}$1"
shift
curl -s -S -D /dev/stderr --compressed \
"--http$(curl --http1.1 &>/dev/null && echo '1.1' || echo '1.0')" \
-H 'Accept: application/json' \
-H "Date: ${now}" \
-H 'Content-Type: application/json' \
  kwilczynski@rocinante  tmp/test  $ cat main.tf
terraform {
required_providers {
test = {
version = "0.1.0"
source = "bazinga.com/test/test"
}
}
}
@natanlao
natanlao / dependabot.md
Last active November 9, 2022 14:48
Automatically merging Dependabot PRs

The best way I've found to automatically merge Dependabot PRs is to use actions/github-script to comment @dependabot merge on Dependabot PRs. There are a few reasons why I think this approach makes sense:

  • Commenting @dependabot merge on a Dependabot PR instructs Dependabot to merge the PR after tests (if any) pass, so we don't need to encode that dependency in a workflow file.

  • Unlike using an auto-merge action, nothing happens if the workflow runs on a

$ cat Vagrantfile
require 'vagrant/util/deep_merge'
h = { hello: "bob" }
Vagrant.configure("2") do |config|
p Vagrant::Util::DeepMerge.deep_merge(h, { hello: "world" })
end
$ vagrant status
func (p *TerraformProvider) initSession() {
p.session = session.Must(session.NewSessionWithOptions(session.Options{
SharedConfigState: session.SharedConfigEnable,
}))
p.session.Handlers.Retry.PushFront(func(r *request.Request) {
if r.IsErrorExpired() {
logrus.WithFields(logrus.Fields{
"region": p.defaultRegion,
}).Debug("Credentials expired. Stop retrying ...")
r.Retryable = aws.Bool(false)
@ityonemo
ityonemo / test.md
Last active April 29, 2025 08:28
Zig in 30 minutes

A half-hour to learn Zig

This is inspired by https://fasterthanli.me/blog/2020/a-half-hour-to-learn-rust/

Basics

the command zig run my_code.zig will compile and immediately run your Zig program. Each of these cells contains a zig program that you can try to run (some of them contain compile-time errors that you can comment out to play with)

@kwilczynski
kwilczynski / test.c
Last active April 19, 2021 18:27
Cleaning up Ruby array in C extension.
#define RSTRING_EMPTY_P(s) (RSTRING_LEN(s) == 0)
static VALUE
magic_strip(VALUE v)
{
return (ARRAY_P(v) || STRING_P(v)) ? \
rb_funcall(v, rb_intern("strip"), 0) : \
Qnil;
}
@niw
niw / README.en.md
Last active March 30, 2025 06:00
How to run Windows 10 on ARM or Ubuntu for ARM64 in QEMU on Apple Silicon Mac

How to run Windows 10 on ARM or Ubuntu for ARM64 in QEMU on Apple Silicon Mac

Here is easy steps to try Windows 10 on ARM or Ubuntu for ARM64 on your Apple Silicon Mac. Enjoy!

NOTE: that this is current, 10/1/2021 state.

Running Windows 10 on ARM

  1. Install Xcode from App Store or install Command Line Tools on your Mac