Most of the scripts is safe to run, at this time only initter.sh actually does something to your system.
However, untill we get some kind of marker/icons to the scripts, indicating if they are safe to be run or not,, Please! read through before use! In my working career I've seen some shortcommings just because someone did not read through the code the pasted from Internet.

TODO useful_stuff.php

Initter.sh

Simple script to run on freshly installed linux-machines with apt.


#!/bin/bash

echo ":: Starting update with apt"
apt-get update && apt-get upgrade -y
echo ":: Update finished"

apps=(apt-transport-https curl git htop links vim ncdu python3 python3-bs4 sudo tmux watch wget)

echo ":: Installing ${apps[*]}"

apt-get install ${apps[*]} -y

            

Devuan Release Schedule

Always forgetting which release of Devuan corresponds to release of Debian? Forget no more!
I built this mostly to practise bash and python, but also find my self using it alot.

Reqiuments: python3 and python3-bs4 (Beautiful soup)


#!/bin/bash

if [ -f /etc/os-release ]; then
    CURRENTRELEASE=$(cat /etc/os-release | grep VERSION_CODENAME | cut -c 18-)
    echo "Current release: ${CURRENTRELEASE}"
elif [ $(which lsb_release) ]; then
    CURRENTRELEASE=$(lsb_release -c | cut -f 2)
    echo "Current release: ${CURRENTRELEASE}^"
else
    echo "Could not obtain codename of this systems release.."
fi

/path/to/html_table_to_string.py 'https://devuan.org/os/releases' ',' | column -s"," -t
            

#!/usr/bin/python3

"""
This is a pretty dumb script.
All it does is getting the first table from url-input (preferably html) and
breaks it down to stupid strings and applying a separator character.
This is all outputted and easy to use with:
*output* | column -s"|" -t

TODO:
    [ ] Major structure overhaul.
    [ ] Var-names
    [ ] Make a smarter debian_numbers, maybe 'lsb_release -r'
        - Also separate Devuan and Debian 'Jessie'
"""

import sys,requests
from bs4 import BeautifulSoup

url=sys.argv[1]

html_content = requests.get(url).text

soup = BeautifulSoup(html_content, 'lxml')
table = soup.table

debian_numbers = {'Jessie':8, 'Stretch':9, 'Buster':10, 'Bullseys':10}

table_rows = table.find_all('tr')
for tr in table_rows:
    first_row = True
    final = ''
    for row in tr:
        if row.string[:] != '\n':
            if row.string[:] in debian_numbers.keys():
                r = row.string[:].strip() + ' - ' + str(debian_numbers[row.string[:].strip()])
            else:
                r = row.string[:].strip()

            if first_row:
                final += sys.argv[2] + r
                first_row = False
            else:
                final += sys.argv[2] + r
    print(final)
            

Wireguide

A cheat sheet of some of the most common wireplugs and equipment used with computers and other peripheral equipment. Originaly created to support endusers in a Swedish muncipality.
If you have any suggestion to the guide, feel free to contact us!

Windows Task Scheduler

A collection of result codes that task scheduler outputs. The reference is a mix of the lacking documentation from Microsoft, Internet and personal experience.
To get result code, run in Powershell:


$task = Get-SheduledTask -TaskPath '???' | Where-Object {$_.TaskName -eq 'mytask'}
$task | Get-SheduledTaskInfo
				

Reference:


0 - The operation completed successfully
1 - Incorrect function called or unknown function called
2 - File not found
10 - The environment is incorrect
255 - The extended attributes are inconsistent
1056 - Already Running
267008 - Task is ready to run at its next scheduled time
267009 - Task is currently running. Same as 1056?
267010 - The task will not run at the scheduled times because it has been disabled
267011 - Task has not yet run
267012 - There are no more runs scheduled for this task
267013 - One or more of the properties that are needed to run this task on a schedule have not been set
267014 - The last run of the task was terminated by the user
267015 - Either the task has no triggers or the existing triggers are disabled or not set
1073807364 - Cannot open the File
2147750671 - Credentials became corrupted
2147750687 - An instance of this task is already running
2147942401 - "Illegal Function" Was once fixed by setting "Configure For" to Windows Server 2016
2147942402 - File not found
2147942405 - Access denied
2147942487 - Wrong parameter
2147942667 - Check so that "Start in" is configured correctly, example, no extra " or otehr character
2147943140 - Task needs more permissions
2147943467 - Task ended unexpected
2147943645 - The service is not available (is "Run only when an user is logged on" checked?)
2147746132 - Class not registered
2147946720 - The operator or administrator has refused the request
2148073520 - The device that is required by this cryptographic provider is not ready for use
3221225786 - The application terminated as a result of a CTRL+C
3228369022 - Unknown software exception.
				

Powershell - Mimicking the awesome "/usr/bin/watch"

Simple one-liner:


while($true) {cls;Get-ChildItem -Path $pwd;Start-Sleep -Seconds 2}
			

Another way, slightly more sofisticated solution. With this one you can load it into your profile or similiar and call it with:
watch {Get-ChildItem -Path $pwd} -Seconds 5


function watch {
    param (
        $ScriptBlock,
        $Seconds=4
    )

    while ($true) {
        cls
        Write-Output ('Watch reloaded last time at: {0}' -f (Get-Date))
        # Can't really rember whay I needed to use '&', but I belive powershell-hostwindow needed it..
        & $ScriptBlock | Out-Host
        Start-Sleep -Seconds $Seconds
    }
}
			

Remove some irritating Windows-stuff.

Yesterday I found out "areoshake to minimize" was back and would like you to know that these tips here might not work exactly as you want, so keep somekind of backup close. I've also heard there is a nice unnoffical variant of windows that uses the classic start-menu and tries to remove every cortana,tracking and random stupid stuff completly from Windows. So serach the Internet if you are looking towards that kind of direction.. or just use Linux really.

Regpath type value
Disable something with Coratana in start-menu search.
HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Search\CortanaConsent REG_DWORD (32bit) 0
Disable bing-searches in start-menu
HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Search\BingSearchEnabled REG_DWORD (32bit) 0
Disable 'Aero Shake to Minimize'
HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\DisallowShaking REG_DWORD (32bit) 1

Powershell 2.0 is old and have alot of security issues. Make sure to disable it.. with Powershell!


Disable-WindowsOptionalFeature -Online -FeatureName MicrosoftWindowsPowerShellV2Root