Skip to content

Instantly share code, notes, and snippets.

View nicr9's full-sized avatar

Nic Roland nicr9

View GitHub Profile
@nicr9
nicr9 / content_disposition.py
Last active December 24, 2023 07:32
Add `Content-Disposition` header to SimpleHttpServer
#!/usr/bin/env python
from SimpleHTTPServer import SimpleHTTPRequestHandler, test
class CustomRequestHandler(SimpleHTTPRequestHandler):
def end_headers(self):
self.add_content_disposition()
SimpleHTTPRequestHandler.end_headers(self)
def add_content_disposition(self):
self.send_header("Content-Disposition", 'filename="content_disposition.py"')
@nicr9
nicr9 / notes.vb
Last active August 27, 2023 04:14
Visual Basic Cheat Sheet
' Data Types
Integer ' Simple numbers
Double ' Numbers with decimal points
String ' Text (a string of characters)
Boolean ' True or False
' Create a variable
Dim ... as Double ' Put the name of your variable here
@nicr9
nicr9 / nested_function_decorators.py
Created January 20, 2016 23:23
Python decorators with nested functions
def without_params(func):
"""
Outer function takes target function and returns a wrapped one.
"""
def _without_params(*args, **kwargs):
"""
Inner function takes target arguments and makes the call.
"""
return func("Never gonna run around")
@nicr9
nicr9 / i3_install_centos7.sh
Last active October 4, 2018 22:53 — forked from douglascodes/i3-wm_4.10.2_install
Installing i3-wm from source on CentOS 7
yum update
#Install for compiling and configuring needs
yum install nano bzip2 gcc git pkgconfig autoconf automake libtool gperf byacc libxslt bison flex
#Install needed and available development libraries
yum install libxcb-devel libXcursor-devel pango-devel pcre-devel perl-Data-Dumper perl-Pod-Parser startup-notification-devel xcb-util-keysyms-devel xcb-util-devel xcb-util-wm-devel yajl-devel check-devel gettext-devel xterm
yum install xorg-x11-xkb-extras xorg-x11-xkb-utils-devel libxkbfile-devel libev-devel
#Add the following lines to a new file at the below location
@nicr9
nicr9 / Makefile.ex1
Last active June 5, 2018 19:45
Example Makefile for docker project
# Admin commands
all: build up
build:
docker-compose build
up:
docker-compose up -d
@nicr9
nicr9 / .block
Last active April 7, 2018 12:16
d3mind
license: mit
@nicr9
nicr9 / lp2kp.py
Created December 12, 2016 09:29
Lastpass to KeePassX converter
from sys import argv
from collections import defaultdict
import xml.etree.ElementTree as ET
import csv
import datetime
if __name__ == "__main__":
src = argv[1]
dest = argv[1] + ".kp.xml"
current_time = datetime.datetime.now().strftime("%Y-%m-%dT%H:%M")
@nicr9
nicr9 / install_vim.sh
Created August 18, 2016 11:49
Notes on installing vim from source (RedHat)
sudo yum groupinstall 'Development tools'
sudo yum install ncurses ncurses-devel
mkdir -p ~/src/github.com/vim
cd !$
git clone https://github.com/vim/vim.git
cd vim
./configure --prefix=/usr --with-features=huge --enable-pythoninterp --with-compiledby='@nicr9_'
make

Keybase proof

I hereby claim:

  • I am nicr9 on github.
  • I am nicr9 (https://keybase.io/nicr9) on keybase.
  • I have a public key whose fingerprint is 4C6E AE36 AC6C 945F A2B8 1EED 287C AD67 3FAA A6AC

To claim this, I am signing this object:

@nicr9
nicr9 / yubikey_gpg.sh
Created June 22, 2016 20:54
Enabling YubiKey's PGP applet
# Plugin yubikey first!
# Check yubikey connection
ykinfo -a
# Change yubikey mode
ykpersonalize -m82
# Plug yubikey out/in again now!