This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Convenience script for the times when 'nvidia-drivers' updates | |
# and I don't feel like rebooting. This script is intended to be run | |
# from a TTY as it will bring down Xorg and reload the nvidia drivers | |
# | |
# There is no error checking for now. Just bang out commands so I don't | |
# have to. | |
# | |
# Mar 08, 2020 - ncdulo |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; preview-rst.el --- description -*- lexical-binding: t; -*- | |
;; | |
;; This file is not part of GNU Emacs. | |
;; | |
;;; Commentary: | |
;; | |
;; Based on the "Intro To Emacs Lisp: Adding Live Preview when Editing Markdown" | |
;; guide at the link below. This has been followed along, but re-written to use | |
;; docutils and rst-mode as I do not have pandoc, nor do I feel I want to deal | |
;; with installing it and it's many Haskell dependencies. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from bs4 import BeautifulSoup | |
import requests | |
def lookup(word, limit=0): | |
''' | |
Return a list of definitions of 'word' from UrbanDictionary, | |
up to 'limit' results returned. A limit <= 0 will return | |
all results. | |
Raises exception through 'requests' upon HTTP-related errors. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def degrees_to_cardinal(degrees): | |
''' | |
Return the cardinal direction representing a given 'degrees' | |
''' | |
cardinal = ['N', 'NNE', 'NE', 'ENE', 'E', 'ESE', 'SE', 'SSE', | |
'S', 'SSW', 'SW', 'WSW', 'W', 'WNW', 'NW', 'NNW'] | |
cardinal_len = len(cardinal) | |
ix = round(degrees / (360.0 / cardinal_len)) | |
return cardinal[ix % cardinal_len] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* An application that illustrates calling the factorial function defined in 'factorial.asm' | |
* https://cs.lmu.edu/~ray/notes/nasmtutorial/ | |
* | |
* To build & run: | |
* nasm -f elf64 factorial.asm && gcc -std=c99 -o factorial2 factorial.o callfactorial.c | |
*/ | |
#include <stdio.h> | |
#include <inttypes.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import requests | |
import urllib.request | |
from bs4 import BeautifulSoup | |
'''When given a list of YouTube URLs inside `yt.txt`, this script will | |
use Requests and BeautifulSoup4 to iterate over that list of URLS and | |
scrape video titles from each link. The output is then appended on to | |
the same `yt.txt` input file. Because of this appendage action, note | |
that running this script multiple times on the same file will result in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Enable or disable Intel Turbo-Boost | |
# Requires msr kernel module to be built and loaded | |
# Will ask for root privileges when the time comes | |
# Copied, with love, from: | |
# https://notepad2.blogspot.com/2014/11/a-script-to-turn-off-intel-cpu-turbo.html | |
if [[ -z $(which rdmsr) ]]; then | |
echo "msr-tools is not installed. Run 'sudo apt-get install msr-tools' to install it." >&2 |