Skip to content

Instantly share code, notes, and snippets.

View andrewgdunn's full-sized avatar

Andrew G. Dunn andrewgdunn

View GitHub Profile
- name: get the device name of the nic of a given mac
command: bash -c "ip a | grep {{macaddress}} -B 1 | awk '{print $2; ; exit}' | sed s/://g"
register: network_device_name
- name: get the pciid of the network device using facts
debug:
msg: "{{ansible_facts[network_device_name.stdout].pciid}}"
# attribution of hash goes to Dr. Mange
# (upper_bound-max_projects) / max_efforts
import argparse
import ipaddress
max_projects = 254
max_efforts = 14
lower_bound = 254
upper_bound = 4094
# from https://cipherli.st/ and https://wiki.mozilla.org/Security/Guidelines/OpenSSH
Port 4252
Protocol 2
HostKey /etc/ssh/ssh_host_ed25519_key
HostKey /etc/ssh/ssh_host_rsa_key
KexAlgorithms curve25519-sha256@libssh.org,diffie-hellman-group-exchange-sha256
Ciphers chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes128-gcm@openssh.com,aes256-ctr,aes192-ctr,aes128-ctr
MACs hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-ripemd160-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512,hmac-sha2-256,hmac-ripemd160,umac-128@openssh.com
AuthenticationMethods publickey
LogLevel VERBOSE
@andrewgdunn
andrewgdunn / w541.md
Created June 26, 2016 15:37
w541 notes

Lenovo ThinkPad W541

The W541 is a workstation laptop based on the Intel Haswell architecture which has an Nvidia GK106GLM (Quadro K2100M) discrete card configured via Optimus.

This architecture poses some challenges within Linux. In the Windows world Nvidia handles all complexities of both adapters, in Linux the herculean effort of the Bumblebee project allows you to tackle the complex topology and have a usable system.

[agd@enoch ~]$ sudo systemctl enable powertop.service
Created symlink from /etc/systemd/system/multi-user.target.wants/powertop.service to /usr/lib/systemd/system/powertop.service.
[agd@enoch ~]$ sudo systemctl status powertop.service
● powertop.service - PowerTOP autotuner
Loaded: loaded (/usr/lib/systemd/system/powertop.service; enabled; vendor preset: disabled)
Active: inactive (dead)
Nov 30 20:56:17 enoch powertop[12581]: RAPL device for cpu 0
Nov 30 20:56:17 enoch powertop[12581]: RAPL Using PowerCap Sysfs : Domain Mask f
Nov 30 20:56:17 enoch powertop[12581]: RAPL device for cpu 0
import pandas as pd
raw_df = pd.read_csv('reddit.r.scotch.tsv', sep='\t')
# Rid ourselves of data we don't need for the recommendation
raw_df.drop('Timestamp', axis=1, inplace=True)
raw_df.drop('Link To reddit Review', axis=1, inplace=True)
raw_df.drop('Region', axis=1, inplace=True)
raw_df.drop('Price', axis=1, inplace=True)
raw_df.drop('Date', axis=1, inplace=True)
@andrewgdunn
andrewgdunn / gist:6389526
Last active December 22, 2015 00:29
If you stumble across this and either have a solution or want to ask more questions... please contact me via email: storrgie at gmail dot com
Edit: TEAC UD-501 on Fedora 19 with MPD 0.17.3 works perfectly.
I think it might have been the commit in kernel 3.10.7
https://www.kernel.org/pub/linux/kernel/v3.x/ChangeLog-3.10.7
==============================================
TEAC UD-501. With MPD on Ubuntu (Server 12.04.2) with ALSA version 1.0.25 with MPD version 0.18
@andrewgdunn
andrewgdunn / gist:5802088
Created June 18, 2013 01:58
Google Chrome, Installed from the google official repositories. "Your profile could not be opened correctly. Some features may be unavailable. Please check that the profile exists and you have permission to read and write its contents"
- Close Chrome.
- Delete the file named Web Data in ~/.config/google-chrome/Default.
- Start Chrome again and everything should be fine.
@andrewgdunn
andrewgdunn / sublime-text-2-install.sh
Created June 17, 2013 19:41
Modified https://gist.github.com/henriquemoody/3288681 to work for me. Doesn't do web request and unpacking, checks for number of arguments.
#!/bin/sh
# Adapted from https://gist.github.com/henriquemoody/3288681
# This script assumes you have unzipped the contents of the
# Sublime 2 distribution to someplace and will set it below
# I personally like to keep this install very mobile
# Set these values
INSTALL="/home/agd/Development/sublime/sublime"
<storrgie> I am in fedora 18 and recently noticed that my mount aliases all dont work
<storrgie> my mount alias looks like this: "alias alexandria_agd='sudo mount -t cifs -o credentials=/etc/samba/creds,dir_mode=0775,file_mode=0775,uid=1000,gid=1000 //alexandria/agd /mnt/alexandria/agd'"
<storrgie> it appears that as of whatever version of cifs fedora 18 has, it seems to ignore the credentials line
<storrgie> its trying to mount as root....
<storrgie> here is me running that alias with a -v: mount.cifs kernel mount options: ip=192.168.1.3,unc=\\alexandria\agd,dir_mode=0775,file_mode=0775,uid=1000,gid=1000,user=root,pass=********