Skip to content

Instantly share code, notes, and snippets.

View lpsantil's full-sized avatar

lpsantil

  • Thousand Oaks, CA
View GitHub Profile
@lpsantil
lpsantil / portable_endian.h
Last active August 29, 2015 14:27 — forked from panzi/portable_endian.h
This provides the endian conversion functions form endian.h on Windows, Linux, *BSD, and Mac OS X. You still need to use -std=gnu99 instead of -std=c99 for gcc. The functions might actually be macros. Functions: htobe16, htole16, be16toh, le16toh, htobe32, htole32, be32toh, le32toh, htobe64, htole64, be64toh, le64toh. License: I hereby put "port…
// "License": Public Domain
// I, Mathias Panzenböck, place this file hereby into the public domain. Use it at your own risk for whatever you like.
// In case there are jurisdictions that don't support putting things in the public domain you can also consider it to
// be "dual licensed" under the BSD, MIT and Apache licenses, if you want to. This code is trivial anyway. Consider it
// an example on how to get the endian conversion functions on different platforms.
#ifndef PORTABLE_ENDIAN_H__
#define PORTABLE_ENDIAN_H__
#if (defined(_WIN16) || defined(_WIN32) || defined(_WIN64)) && !defined(__WINDOWS__)
@lpsantil
lpsantil / preprocessor_fun.h
Last active August 29, 2015 14:27 — forked from aras-p/preprocessor_fun.h
Things to commit just before leaving your job
// Just before switching jobs:
// Add one of these.
// Preferably into the same commit where you do a large merge.
//
// This started as a tweet with a joke of "C++ pro-tip: #define private public",
// and then it quickly escalated into more and more evil suggestions.
// I've tried to capture interesting suggestions here.
//
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_,
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant,
var times = 500000
function bm(label, fn) {
var start = +new Date
fn()
print(' ' + label + ' : ' + (+new Date - start) + ' ms')
}
print('\n running ' + times + ' times\n')
#!/usr/bin/env zsh
datadir=${XDG_DATA_HOME:-$HOME/.local/share}/windows
mkdir -m 0700 -p $datadir
git -C $datadir init
logfile=$datadir/windows-vms
exec >>$logfile
date=$(date)
echo
echo "# $date"
curl -fsSL https://developer.microsoft.com/en-us/microsoft-edge/api/tools/vms/ | \
@lpsantil
lpsantil / Makefile
Created May 12, 2017 04:54 — forked from skeeto/Makefile
C Object Oriented Programming Example
CFLAGS = -std=c99 -Wall
main : main.o
.PHONY : test clean
test : main
./$^ "*regex*" "*vtable*" < main.c
clean :
@lpsantil
lpsantil / ns.sh
Created June 19, 2017 20:00 — forked from lanrat/ns.sh
netstat in bash with proc
#! /bin/bash
#get all data
ROUTE=$(cat /proc/net/route | grep -v "Iface")
TCP=$(cat /proc/net/tcp | grep "[0-9]: ")
UDP=$(cat /proc/net/udp | grep "[0-9]: ")
SOCKETS=$(ls -l $(find /proc/*/fd/ -type l 2>/dev/null) 2>/dev/null | grep socket)
parse_ipv4()
@lpsantil
lpsantil / framebuffer.c
Created July 18, 2017 07:49 — forked from FredEckert/framebuffer.c
Paint Pixels to Screen via Linux FrameBuffer
/*
To test that the Linux framebuffer is set up correctly, and that the device permissions
are correct, use the program below which opens the frame buffer and draws a gradient-
filled red square:
retrieved from:
Testing the Linux Framebuffer for Qtopia Core (qt4-x11-4.2.2)
http://cep.xor.aps.anl.gov/software/qt4-x11-4.2.2/qtopiacore-testingframebuffer.html
*/
@lpsantil
lpsantil / create-iso.sh
Created July 24, 2017 23:38 — forked from julianxhokaxhiu/create-iso.sh
Simple bash script to create a Bootable ISO from macOS Sierra Install Image from Mac App Store
#!/bin/bash
#
# Credits to fuckbecauseican5 from https://www.reddit.com/r/hackintosh/comments/4s561a/macos_sierra_16a238m_install_success_and_guide/
# Adapted to work with the official image available into Mac App Store
#
# Enjoy!
hdiutil attach /Applications/Install\ macOS\ Sierra.app/Contents/SharedSupport/InstallESD.dmg -noverify -nobrowse -mountpoint /Volumes/install_app
hdiutil create -o /tmp/Sierra.cdr -size 7316m -layout SPUD -fs HFS+J
hdiutil attach /tmp/Sierra.cdr.dmg -noverify -nobrowse -mountpoint /Volumes/install_build
@lpsantil
lpsantil / infra-secret-management-overview.md
Created November 14, 2017 16:53 — forked from maxvt/infra-secret-management-overview.md
Infrastructure Secret Management Software Overview

Currently, there is an explosion of tools that aim to manage secrets for automated, cloud native infrastructure management. Daniel Somerfield did some work classifying the various approaches, but (as far as I know) no one has made a recent effort to summarize the various tools.

This is an attempt to give a quick overview of what can be found out there. The list is alphabetical. There will be tools that are missing, and some of the facts might be wrong--I welcome your corrections. For the purpose, I can be reached via @maxvt on Twitter, or just leave me a comment here.

There is a companion feature matrix of various tools. Comments are welcome in the same manner.

@lpsantil
lpsantil / openshift-cheatsheet.md
Created April 2, 2018 23:49 — forked from rafaeltuelho/openshift-cheatsheet.md
My Openshift Cheatsheet
  • Binary Builds
oc new-build --binary=true --name=ola2 --image-stream=redhat-openjdk18-openshift
oc start-build ola2 --from-file=./target/ola.jar --follow
oc new-app 
  • Turn off/on DC triggers to do a batch of changes without spam many deployments