Skip to content

Instantly share code, notes, and snippets.

View praveenkumar's full-sized avatar
🏠
Working from home

Praveen Kumar praveenkumar

🏠
Working from home
View GitHub Profile
apiVersion: v1
items:
- apiVersion: v1
kind: ImageStream
metadata:
annotations:
openshift.io/image.dockerRepositoryCheck: 2017-06-28T15:00:23Z
creationTimestamp: null
generation: 2
labels:
@xjdrew
xjdrew / client.go
Last active February 9, 2025 16:52
golang tls client and server, require and verify certificate in double direction
package main
import (
"crypto/tls"
"crypto/x509"
"flag"
"io"
"io/ioutil"
"log"
"os"
@marcan
marcan / linux.sh
Last active July 21, 2024 14:00
Linux kernel initialization, translated to bash
#!/boot/bzImage
# Linux kernel userspace initialization code, translated to bash
# (Minus floppy disk handling, because seriously, it's 2017.)
# Not 100% accurate, but gives you a good idea of how kernel init works
# GPLv2, Copyright 2017 Hector Martin <[email protected]>
# Based on Linux 4.10-rc2.
# Note: pretend chroot is a builtin and affects the current process
# Note: kernel actually uses major/minor device numbers instead of device name
@so0k
so0k / kubectl.md
Last active February 4, 2025 17:16
Playing with kubectl output

Kubectl output options

Let's look at some basic kubectl output options.

Our intention is to list nodes (with their AWS InstanceId) and Pods (sorted by node).

We can start with:

kubectl get no
@jasonbrooks
jasonbrooks / kube-setenforce-1.md
Last active January 5, 2017 20:38
kubernetes ansible setenforce 1

I use these ansible scripts (see also) to bring up kubernetes clusters, on centos and fedora. The scripts are awesome, but they put selinux into permissive mode, because, "tokens and selinux don't work together."

That's unfortunate, because one of the main things I'm doing when I turn up a kubernetes cluster is bug-hunting, and selinux can be a source of bugs.

I commented out the bit that put selinux into permissive mode:

#- name: Set selinux permissive because tokens and selinux don't work together
#  selinux: state=permissive policy={{ ansible_selinux.type }}
# when: ansible_selinux is defined and ansible_selinux.status == "enabled"
@mastef
mastef / isexist_vs_isnotexist.go
Created February 4, 2016 08:30
os.IsExist(err) vs os.IsNotExist(err)
/*
Watch out, os.IsExist(err) != !os.IsNotExist(err)
They are error checkers, so use them only when err != nil, and you want to handle
specific errors in a different way!
Their main purpose is to wrap around OS error messages for you, so you don't have to test
for Windows/Unix/Mobile/other OS error messages for "file exists/directory exists" and
"file does not exist/directory does not exist"
#!/usr/bin/env ruby
require 'rubydns'
INTERFACES = [
[:udp, "0.0.0.0", 53],
[:tcp, "0.0.0.0", 53]
]
Name = Resolv::DNS::Name
IN = Resolv::DNS::Resource::IN
@zchee
zchee / cgo.md
Last active April 17, 2025 04:57
cgo convert list

See also, http://libraryofalexandria.io/cgo/

Using Go cgo

cgo has a lot of trap.
but Not "C" pkg also directory in $GOROOT/src. IDE's(vim) Goto command not works.

So, Here collect materials.

@tanb
tanb / xhyve-freebsd-tutorial-1.md
Last active November 27, 2021 13:07
FreeBSD running on xhyve tutorial. (Appendix: Resize image with qemu. Create FreeBSD VM with qemu).

TL;DR

  • Create 5GB FreeBSD image.
  • Install FreeBSD on xhyve.
  • Mount host directory.

Requisites

progrium/bashstyle

Bash is the JavaScript of systems programming. Although in some cases it's better to use a systems language like C or Go, Bash is an ideal systems language for smaller POSIX-oriented or command line tasks. Here's three quick reasons why:

  • It's everywhere. Like JavaScript for the web, Bash is already there ready for systems programming.
  • It's neutral. Unlike Ruby, Python, JavaScript, or PHP, Bash offends equally across all communities. ;)
  • It's made to be glue. Write complex parts in C or Go (or whatever!), and glue them together with Bash.

This document is how I write Bash and how I'd like collaborators to write Bash with me in my open source projects. It's based on a lot of experience and time collecting best practices. Most of them come from these two articles, but here integrated, slightly modified, and focusing on the most bang for buck items. Plus some ne