Skip to content

Instantly share code, notes, and snippets.

🦉
owl be coding

Maddison Hellstrom b0o

🦉
owl be coding
Block or report user

Report or block b0o

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ddevault
ddevault / Makefile
Last active Jul 5, 2019
Tiny Wayland compositor
View Makefile
WAYLAND_PROTOCOLS=/usr/share/wayland-protocols
# wayland-scanner is a tool which generates C headers and rigging for Wayland
# protocols, which are specified in XML. wlroots requires you to rig these up
# to your build system yourself and provide them in the include path.
xdg-shell-protocol.h:
wayland-scanner server-header \
$(WAYLAND_PROTOCOLS)/stable/xdg-shell/xdg-shell.xml $@
xdg-shell-protocol.c: xdg-shell-protocol.h
@jdarpinian
jdarpinian / hello-world.shc
Last active Feb 6, 2018
Directly execute C source code by embedding in a bash script.
View hello-world.shc
#!/bin/bash
COMPILER_OPTIONS="-g -Wall -Wextra --std=c11 -O1 -fsanitize=address,undefined"
SOURCE_CODE=$(cat <<'END_OF_SOURCE_CODE'
#include <stdio.h>
int main() {
printf("Hello world!\n");
return 0;
}
@ZenGround0
ZenGround0 / client.go
Last active Feb 24, 2019
golang http auto-streaming with transfer-encoding: chunked
View client.go
package main
import (
"net/http"
"net/url"
"os"
"fmt"
)
@staaldraad
staaldraad / uid_awk.sh
Created Dec 12, 2017
Get the uid, gid and user groups without touching /etc/passwd or running the `id` command
View uid_awk.sh
awk -F: 'END {print "uid:"u" gid:"g" groups:"gg}{if($1=="Uid"){split($2,a," ");u=a[1]}if($1=="Gid"){split($2,a," ");g=a[1]}if($1=="Groups"){gg=$2}}' /proc/self/status
@staaldraad
staaldraad / awk_netstat.sh
Last active Jul 12, 2019
AWK to get details from /proc/net/tcp and /proc/net/udp when netstat and lsof are not available
View awk_netstat.sh
# Gawk version
# Remote
grep -v "rem_address" /proc/net/tcp | awk '{x=strtonum("0x"substr($3,index($3,":")-2,2)); for (i=5; i>0; i-=2) x = x"."strtonum("0x"substr($3,i,2))}{print x":"strtonum("0x"substr($3,index($3,":")+1,4))}'
# Local
grep -v "rem_address" /proc/net/tcp | awk '{x=strtonum("0x"substr($2,index($2,":")-2,2)); for (i=5; i>0; i-=2) x = x"."strtonum("0x"substr($2,i,2))}{print x":"strtonum("0x"substr($2,index($2,":")+1,4))}'
# No Gawk
# Local
grep -v "rem_address" /proc/net/tcp | awk 'function hextodec(str,ret,n,i,k,c){
@sebastiencs
sebastiencs / volume.sh
Last active May 1, 2019
Script to get volume notification with dunst http://imgur.com/a/qWgAw
View volume.sh
#!/bin/bash
# You can call this script like this:
# $./volume.sh up
# $./volume.sh down
# $./volume.sh mute
function get_volume {
amixer get Master | grep '%' | head -n 1 | cut -d '[' -f 2 | cut -d '%' -f 1
}
@naelstrof
naelstrof / monitorshot.sh
Last active Aug 22, 2017
This script intercepts specific user selections and replaces them with monitor geometry.
View monitorshot.sh
#!/bin/bash
# This script intercepts specific user selections and replaces them with monitor geometry.
# The specific user selection is when they click on the root window, or attempt to select the whole X screen.
# Currently there is a bug, clicking and dragging the entire screen will still proc the replacement,
# and only screenshot the monitor that the mouse is on after the drag. There's no way around this without
# changing slop to indicate when a user clicked or dragged. (Which might be done if people care enough.)
# Get a normal selection
read -r X Y W H G ID < <(slop -f "%x %y %w %h %g %i")
@sgf-dma
sgf-dma / fix-mupdf-fullscreen-xmonad.hs
Created Mar 6, 2017
fix-mupdf-fullscreen-xmonad.hs
View fix-mupdf-fullscreen-xmonad.hs
import Data.Maybe
import Control.Monad
import XMonad
import XMonad.Hooks.EwmhDesktops
addNETSupported :: Atom -> X ()
addNETSupported x = withDisplay $ \dpy -> do
r <- asks theRoot
a_NET_SUPPORTED <- getAtom "_NET_SUPPORTED"
a <- getAtom "ATOM"
@roadrunner2
roadrunner2 / 0 Linux-On-MBP-Late-2016.md
Last active Jul 16, 2019
Linux on MacBook Pro Late 2016 and Mid 2017 (with Touchbar)
View 0 Linux-On-MBP-Late-2016.md

Introduction

This is about documenting getting Linux running on the late 2016 and mid 2017 MPB's; the focus is mostly on the MacBookPro13,3 and MacBookPro14,3 (15inch models), but I try to make it relevant and provide information for MacBookPro13,1, MacBookPro13,2, MacBookPro14,1, and MacBookPro14,2 (13inch models) too. I'm currently using Fedora 27, but most the things should be valid for other recent distros even if the details differ. The kernel version is 4.14.x (after latest update).

The state of linux on the MBP (with particular focus on MacBookPro13,2) is also being tracked on https://github.com/Dunedan/mbp-2016-linux . And for Ubuntu users there are a couple tutorials (here and here) focused on that distro and the MacBook.

Note: For those who have followed these instructions ealier, and in particular for those who have had problems with the custom DSDT, modifying the DSDT is not necessary anymore - se

@ssaavedra
ssaavedra / 57-add-emoji-support.conf
Created Jun 19, 2016
Add Emoji to Linux Fontconfig
View 57-add-emoji-support.conf
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<!--
EmojiOne Color SVGinOT Font
Author: Santiago Saavedra <ssaavedra@gpul.org>
License: CC0
Year: 2016
Install:
You can’t perform that action at this time.