Skip to content

Instantly share code, notes, and snippets.

View SirJson's full-sized avatar
:electron:
Am Heimcomputer sitz' ich hier, und programmier' die Zukunft mir

Raffael Zica SirJson

:electron:
Am Heimcomputer sitz' ich hier, und programmier' die Zukunft mir
View GitHub Profile
@SirJson
SirJson / Quirks of C.md
Created October 3, 2018 01:58 — forked from fay59/Quirks of C.md
Quirks of C

Here's a list of mildly interesting things about the C language that I learned mostly by consuming Clang's ASTs. Although surprises are getting sparser, I might continue to update this document over time.

There are many more mildly interesting features of C++, but the language is literally known for being weird, whereas C is usually considered smaller and simpler, so this is (almost) only about C.

1. Combined type and variable/field declaration, inside a struct scope [https://godbolt.org/g/Rh94Go]

struct foo {
   struct bar {
 int x;
@SirJson
SirJson / i3-select-style.sh
Created October 20, 2018 21:52
Shell script for selecting i3-styles via dmenu
#!/bin/bash
I3CFG="$HOME/.config/i3/config"
STYLE=$(i3-style -l | sed -e 's/\s[-].*//' | sed -e 's/Available themes://' | tr -d '[:cntrl:]' | tr -s '[:blank:]' '\n' | tail -n +2 | dmenu)
i3-style $STYLE -o $I3CFG -r
@SirJson
SirJson / crawl-agents.js
Last active October 25, 2018 22:26
Crawl User Agent DB from whatismybrowser.com
// You only need the developer console for this. JS rocks!.. sometimes
document.querySelectorAll(".useragent").forEach(x => console.log('"'+x.childNodes[0].innerHTML+'"'))
@SirJson
SirJson / user-agents.sh
Created October 25, 2018 22:37
A list of common Browser User Agents from Windows, Linux and Mac
#!/bin/bash
# The first line is the data source you are looking for
# The last two lines select a random one from the array above for demostration
USERAGENTS=("Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.157 Safari/537.36" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:15.0) Gecko/20100101 Firefox/15.0" "Mozilla/5.0 (Unknown; Linux) AppleWebKit/538.1 (KHTML, like Gecko) Chrome/v1.0.0 Safari/538.1" "Mozilla/5.0 (X11; Linux x86_64; rv:10.0) Gecko/20150101 Firefox/47.0 (Chrome)" "Mozilla/5.0 (SMART-TV; X11; Linux armv7l) AppleWebKit/537.42 (KHTML, like Gecko) Chromium/25.0.1349.2 Chrome/25.0.1349.2 Safari/537.42" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML" "Mozilla/5.0 (Linux; NetCast; U) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/34.0.1847.137 Safari/537.31 SmartTV/6.0
@SirJson
SirJson / simple-xkcd.css
Created November 22, 2018 00:39
Simple fix for when the posititioning of all elements is messed up @ xkcd.com
@-moz-document domain("xkcd.com") {
@namespace url(http://www.w3.org/1999/xhtml);
body {
background: #fff!important;
width: inherit;
position: inherit;
}
.box {
background: #fff;
@SirJson
SirJson / quickydl.sh
Created December 29, 2018 20:43
Just a quicky
#!/bin/sh
youtube-dl --prefer-free-formats --youtube-skip-dash-manifest -x --audio-format best $1
@SirJson
SirJson / Linux_DRM_OpenGLES.c
Created January 6, 2019 09:34 — forked from Miouyouyou/Linux_DRM_OpenGLES.c
An example, inspired by Rob Clark "kmscube.c" that uses Linux Direct Rendering Manager ( DRM ) and EGL to create an OpenGL ES 2 context. This is a standalone example, that just clears the screen with a blueish color. Usable with Rockchip DRM drivers and Mali Wayland/DRM userspace drivers.
// gcc -o drmgl Linux_DRM_OpenGLES.c `pkg-config --cflags --libs libdrm` -lgbm -lEGL -lGLESv2
/*
* Copyright (c) 2012 Arvin Schnell <arvin.schnell@gmail.com>
* Copyright (c) 2012 Rob Clark <rob@ti.com>
* Copyright (c) 2017 Miouyouyou <Myy> <myy@miouyouyou.fr>
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
@SirJson
SirJson / i3-gaps_installation_guide.md
Created March 28, 2019 04:17 — forked from boreycutts/i3-gaps_installation_guide.md
A simple installation guide for i3-gaps

Installing i3-gaps

Dependencies

i3-gaps has some packages that are required for it to work so install these things:

sudo apt install libxcb1-dev libxcb-keysyms1-dev libpango1.0-dev libxcb-util0-dev libxcb-icccm4-dev libyajl-dev libstartup-notification0-dev libxcb-randr0-dev libev-dev libxcb-cursor-dev libxcb-xinerama0-dev libxcb-xkb-dev libxkbcommon-dev libxkbcommon-x11-dev autoconf xutils-dev libtool automake

You also need to install libxcb-xrm-dev, but I got Unable to locate package libxcb-xrm-dev when trying to install from the apt repositories on Ubuntu 16.04. If this happens to you, just install it from source using these commands:

mkdir tmp
@SirJson
SirJson / README.md
Created March 28, 2019 18:03 — forked from dries007/README.md
rPi Netboot TFTP setup for OSDev

rPi Netboot TFTP setup

This is not a tutorial, it's some hints to get up and going. All of this assumes you are using Linux. (As you should!)

This setup will let you boot the rPi from a folder on your disk over the network. This makes life much easier if you are iterating over changes. All you need is an easy way to reboot the pi (cable with switch or a switchable power supply).

Based on documentation from rPi foundation.

@SirJson
SirJson / Theme.css
Last active April 8, 2019 14:43
Material Fonts and Sizes for fman + HiDPI fix. Version 3. Includes the SCSS source file with all my notes and the resulting CSS file for use in fman. Note: I did not update the source scss file yet.
* {
font-family: Roboto, Noto Sans, Segoe UI, Ubuntu, sans-serif;
font-size: 12pt;
font-weight: normal;
}
th {
vertical-align: center;
font-size: 10pt;
padding-top: 8px;