Skip to content

Instantly share code, notes, and snippets.

View LeSpocky's full-sized avatar

Alexander Dahl LeSpocky

View GitHub Profile
@LeSpocky
LeSpocky / collectip.sh
Created July 3, 2013 11:40
Get outside IPv4 address and echo a line for adding to some poor mans database for later analyzation.
#!/bin/sh
UTCNOW=$(date -u +%s)
CURRENTIP=$(wget -q -O - checkip.dyndns.com | sed -e 's/^.*<body>\(.*\)<\/body>.*$/\1/' | cut -f2 -d: | tr -d [:space:])
echo "${UTCNOW},${CURRENTIP}"
exit 0
@LeSpocky
LeSpocky / bash_colours
Created January 25, 2016 12:40 — forked from ian128K/bash_colours
Shell script colours
## Colours and font styles
## Syntax: echo -e "${FOREGROUND_COLOUR}${BACKGROUND_COLOUR}${STYLE}Hello world!${RESET_ALL}"
# Escape sequence and resets
ESC_SEQ="\x1b["
RESET_ALL="${ESC_SEQ}0m"
RESET_BOLD="${ESC_SEQ}21m"
RESET_UL="${ESC_SEQ}24m"
# Foreground colours
# ----------------------------------------------------------------------
# quick and dirty color helping stuff
# ----------------------------------------------------------------------
ESC_START='\033['
ESC_SEP=';'
ESC_END='m'
COL_RST="${ESC_START}0${ESC_END}"
COL_BOLD='1'
@LeSpocky
LeSpocky / check_session.txt
Created November 12, 2018 11:18
asciio example output
.-----------------. no
| session exists |-----------------.
'-----------------' |
| yes |
v v
.-----------------. yes .-------------------.
| session expired |------>| redirect to login |
'-----------------' '-------------------'
| no ^
#include <stdio.h>
#include <unistd.h>
int main( int argc, char *argv[] )
{
char c = '-';
printf( "throbber: [-]" );
while ( 1 )
{
@LeSpocky
LeSpocky / sample_output
Last active June 25, 2020 08:08 — forked from JonathonReinhart/sample_output
Show Ethernet drivers on Linux
% what_eth_drivers.sh
br0 [ac:22:0b:c3:cd:2a]: (up)
docker0 [02:42:6b:bb:b4:67]: (down)
enp3s0 [ac:22:0b:c3:cd:2a]: r8169 (up)
enp5s0 [00:01:02:d8:91:07]: 3c59x (unknown)
enx00e04c6800e5 [00:e0:4c:68:00:e5]: r8152 (down)
lo [00:00:00:00:00:00]: (unknown)
vmnet1 [00:50:56:c0:00:01]: (unknown)
vmnet8 [00:50:56:c0:00:08]: (unknown)
@LeSpocky
LeSpocky / create-ptxdist-bsp-from-scratch.md
Created March 8, 2023 08:26
Create a ptxdist BSP from scratch

Create a ptxdist BSP from scratch

  1. Install ptxdist itself and a suitable toolchain as described in the documentation
  2. Create an empty BSP folder
  3. Create the subfolders configs and configs/platform-foo (replace foo by something more sensible like v7a or x86_64)
  4. Create empty files configs/ptxconfig and configs/platform-foo/platformconfig
  5. Call ptxdist-2023.03.0 --force menu (or whatever version you installed in step 1, be sure to call the binary including the version number)
  6. Select menuconfig, do some changes, save
  7. Select platformconfig, do some changes, save
@LeSpocky
LeSpocky / my-gen-msgid.sh
Created March 29, 2023 13:15 — forked from mricon/my-gen-msgid.sh
my-gen-msgid
#!/bin/bash
# This generates lore-friendly message-id headers that are safe, unique, and
# provide better UX for someone using lore to retrieve messages.
#
# Instructions for using with mutt/neomutt:
#
# Save this as ~/bin/my-gen-msgid, then add ~/.mutt-fix-msgid with the following,
# fixing your path to the file:
#
# my_hdr Message-ID: <`/home/user/bin/my-gen-msgid`>
@LeSpocky
LeSpocky / post-migrate-helper.sh
Created August 16, 2023 13:59
detect changes on BSP files shadowing ptxdist files after migrate
#!/bin/bash
SCRIPTDIR=$(dirname "${0}")
PTXDIST_SRC=$1
PTXDIST_VER_FROM=$2
PTXDIST_VER_TO=$3
PTXDIST_BASEDIR='/usr/local/lib'
PTXDIST_TOPDIR="$(ptxdist print PTXDIST_TOPDIR)"
PTXDIST_WORKSPACE="$(ptxdist print PTXDIST_WORKSPACE)"
@LeSpocky
LeSpocky / glibc.cmake
Last active October 13, 2023 09:24 — forked from likema/glibc.cmake
CMake macro to detect glibc version by filename.
#[=======================================================================[.rst:
glibc
-----
Check glibc version.
Result variables
^^^^^^^^^^^^^^^^
``GLIBC_VERSION``
glibc version.