Skip to content

Instantly share code, notes, and snippets.

View cmavr8's full-sized avatar

Chris Mavrakis cmavr8

View GitHub Profile
@cmavr8
cmavr8 / autoyumaconf.sh
Created February 10, 2012 22:43
Dirty script to automate making and installing code to NETCONF server - using YUMA tools
#!/bin/bash
# Script to automate making and installing C++ code to NETCONF server config, based on a YANG module file (module_name.yang). Created by Chris Mavrakis <sec@cmavrakis.com>, 21-Nov-2011.
# The code is messy and does not do ANY checks... so be careful. Inspect it yourself before using it, I will have no responsibility if something bad happens. Info about YANG, YUMA etc can be found here: http://www.netconfcentral.org
### Please edit the following two options:
### 1. What is the name of your Module? This should be your filename's first part (before the ".yang")
MODULENAME=MYMODULE
@cmavr8
cmavr8 / ocsusers.sh
Last active October 1, 2015 01:28
Examine OCS (Open Conference Systems) users
#!/bin/bash
# Little script to examine a PKP OCS user database. Instructions:
# 1. Login to OCS and export the users as an xml
# 2. Convert the file to CSV using e.g. Stylus studio 2011 XML Enterprise Suite
# 3. Change this line:
INPUT=users.csv
# 4. Run the script
@cmavr8
cmavr8 / z370Power
Created December 6, 2012 16:57
Power optimization script for the Lenovo Ideapad Z370a
#!/bin/sh
# Power optimization script for the Lenovo Ideapad Z370a. Written by Chris Mavrakis (cmavr8@gmail.com).
# Place in /usr/lib/pm-utils/power.d and make executable.
case $1 in
false) # On AC power!
# Intel HD audio power management:
@cmavr8
cmavr8 / gnome shortcuts
Created March 26, 2013 19:10
I had this bug's problem (https://bugs.launchpad.net/ubuntu/+source/gnome-control-center/+bug/990727) and also the fact that my shortcuts are "forgotten" on each reboot. So I made this script that is run upon login and restores my custom shortcuts.
#!/bin/bash
echo "Doing..."
gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-down "['<Primary><Alt>s']"
gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-left "['<Primary><Alt>a']"
gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-right "['<Primary><Alt>d']"
gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-up "['<Primary><Alt>w']"
@cmavr8
cmavr8 / encoder-x265
Created December 8, 2016 13:09
Super quick & dirty script to convert all video files of specific extension into x265 mp4s. Sure, it can be made fancy, but there's not enough motivation for it.
#!/bin/bash
# Super quick & dirty script to convert all video files of specific extension into x265 mp4s. Sure, it can be made fancy, but there's not enough motivation for it.
# v1 - 8-Dec-2016 by Chris Mavrakis
# How to use:
# Cd into the dir of your source video files.
# Change the .avi extension and target file dir in the script.
# Run the script.
@cmavr8
cmavr8 / update_docker
Last active May 29, 2020 08:53
Pulls a Docker image and compares it to running ones. Stops/removes/restarts the ones that are outdated. Warning: This is obviously a few years old and has not been updated. Do not use unless you review and ensure it's still OK. BTW, there are better ways to do this today.
#!/usr/bin/env bash
# Pulls a Docker image and compares it to running ones. Stops/removes/restarts the ones that are outdated.
# Put in /etc/cron.daily and make executable. One per image.
# From: http://stackoverflow.com/questions/26423515/how-to-automatically-update-your-docker-containers-if-base-images-are-updated/26548914
set -e
IMAGE="<DEVELOPER>/<DOCKERIMAGE>:latest"
CID=$(docker ps | grep $IMAGE | awk '{print $1}')
docker pull $IMAGE
@cmavr8
cmavr8 / mac-brew-apps
Last active March 30, 2021 04:43
List of apps installed on Mac OSX using brew. See this article for background: https://diyistheway.blogspot.com/2019/04/notes-on-setting-up-new-mac.html
ansible
aom
assimp
bat
bdw-gc
berkeley-db
c-ares
cairo
composer
dav1d
@cmavr8
cmavr8 / secure-ssh.yml
Last active January 4, 2024 19:52
Secure SSH configuration ansible playbook. Last updated years ago, NOT recommended for use. There are better ways to do this today.
---
# SSH server settings, in line with https://stribika.github.io/2015/01/04/secure-secure-shell.html
# Before using, change myhosts to your hosts' nickname and myuser to your username (two instances! make sure you replace both or you'll be locked out of ssh!)
- hosts: myhosts
become: true
remote_user: myuser
tasks:
# Key exchange, ciphers and MACs
- lineinfile: dest=/etc/ssh/sshd_config regexp='^KexAlgorithms' line='KexAlgorithms curve25519-sha256@libssh.org,diffie-hellman-group-exchange-sha256'