Skip to content

Instantly share code, notes, and snippets.

View daerich's full-sized avatar
👁️
Carefully watching

DaErich daerich

👁️
Carefully watching
  • Lucent Division
  • leaq %rax, Germany(%rip),
View GitHub Profile
@daerich
daerich / subst.rb
Created January 10, 2022 00:38
replace incorrect temp degree values
#!/usr/bin/env ruby
ARGF.each {|line|
if line =~ /,[[:digit:]]{2,2}/
puts $` + ",#{$&[1,2].to_i - 10}" + $'
else
puts line
end
}

DaErich's OpenBSD checklist

  • Add user to network group(wireless networking)
  • Configure tapping and brightness with wsconsctl
  • wpa_supplicant for EAP
  • Set apmd to -A
  • pkg_add -l
  • mount_mfs and chmod /tmp 1777 (tmpfs is bugged/disable on OpenBSD)
@daerich
daerich / .config
Created December 5, 2021 23:00
Kernel dotconfig
#
# Automatically generated file; DO NOT EDIT.
# Linux/x86 5.15.6 Kernel Configuration
#
CONFIG_CC_VERSION_TEXT="gcc (GCC) 10.2.1 20201203"
CONFIG_CC_IS_GCC=y
CONFIG_GCC_VERSION=100201
CONFIG_CLANG_VERSION=0
CONFIG_AS_IS_GNU=y
CONFIG_AS_VERSION=23501
@daerich
daerich / codingstyle.md
Last active July 29, 2022 14:05
Coding Style

DaErich's coding style

For general advice see: Linux kernel coding style

The following amendments / clarifications are to be considered additionally:

  • Kernel-Normal-Form for Function-Blocks Within function blocks the protypes are to be formatted like in KNF Indentions are four spaced:
int
main(int argc, char** argv)
{
@daerich
daerich / binarycalc.py
Created October 30, 2021 16:19
rough impl or base10 to any base calculation ignoring sign
#!/usr/bin/env python
import sys
# Can't do 2 complement :C
res=None
quot=int(sys.argv[1])
base=int(sys.argv[2])
resstr=""
while quot != 0:
res = quot % base
@daerich
daerich / .vimrc
Last active August 6, 2021 20:33
Vim RunCommands
source $VIMRUNTIME/defaults.vim
:function PythonEnt(isnf,lang)
:let l:filen = expand("%:p")
:if a:lang == "Py"
:if len(glob("*.py",0,1)) <= 1 && !a:isnf
\&& filewritable(filen)
\&& getfsize(filen) == 0
:call setline(1,"#!/usr/bin/env python")
@daerich
daerich / .bashrc
Last active February 6, 2022 01:02
Bash run commands
#
# ~/.bashrc
#
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
alias ls='ls --color=auto'
PS1='\[\033[0;32m\]<\u\[\033[0;31m\]::\[\033[0;32m\]\h\[\033[1;34m\] \W \$\[\033[0;32m\] > \[\033[0m\]'
@daerich
daerich / procparse.c
Last active June 28, 2021 11:17
Parse proc directory
/* BEGIN Cue */
#include <std{io,lib}.h>
#include <string.h>
#include <sys/types.h>
#include <dirent.h>
#include <unistd.h>
static int in_numbers(char *);
static int check_by_slsh(char*,char*);
static void check_proc(char*,char*,char*);
@daerich
daerich / stdin.c
Last active May 20, 2021 15:54
read from stdin(my own template)(may be horrible)
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
static char* addread(char* buf,char r, int length){
char * res=malloc((length+1) * sizeof(char));
if(res == NULL){
fprintf(stderr,"Malloc Error\n"); /* Quit on malloc*/
exit(1);
@daerich
daerich / bash_prompt.txt
Created April 11, 2021 00:45
My bash_prompt
\[\033[0;32m\]<\u\[\033[0;31m\]::\[\033[0;32m\]\h\[\033[1;34m\] \W \$\[\033[0;32m\] > \[\033[0m\]