Skip to content

Instantly share code, notes, and snippets.

@CodeShane
CodeShane / Visual Studio solution file headers
Last active September 19, 2018 17:07 — forked from DanAtkinson/Visual Studio solution file headers
Visual Studio solution file headers - 2010, 2012, 2013, 2015, 2017
=verified all libs through ipc 20180919 version are included in this list, not that we have all these headers=
== Visual Studio 2005 (DO NOT COPY THIS LINE) ==
Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
== Visual Studio 2010 (DO NOT COPY THIS LINE) ==
Microsoft Visual Studio Solution File, Format Version 11.00
@CodeShane
CodeShane / balloontip.py
Created December 8, 2018 15:04 — forked from boppreh/balloontip.py
Balloon tip module, Python, using win32gui. Display a notification in the tray bar and quits after 10 seconds.
# -- coding: utf-8 --
from win32api import *
from win32gui import *
import win32con
import sys, os
import struct
import time
class WindowsBalloonTip:
@CodeShane
CodeShane / README-oneshot-systemd-service.md
Created March 1, 2019 08:35 — forked from drmalex07/README-oneshot-systemd-service.md
An example with an oneshot service on systemd. #systemd #systemd.service #oneshot

README

Services declared as oneshot are expected to take some action and exit immediatelly (thus, they are not really services, no running processes remain). A common pattern for these type of service is to be defined by a setup and a teardown action.

Let's create a example foo service that when started creates a file, and when stopped it deletes it.

Define setup/teardown actions

Create executable file /opt/foo/setup-foo.sh:

@CodeShane
CodeShane / gist:c51afc417b8d0e24b53c1ee015cec354
Created February 16, 2020 06:24 — forked from cdown/gist:1163649
Bash urlencode and urldecode
urlencode() {
# urlencode <string>
old_lc_collate=$LC_COLLATE
LC_COLLATE=C
local length="${#1}"
for (( i = 0; i < length; i++ )); do
local c="${1:i:1}"
case $c in
[a-zA-Z0-9.~_-]) printf "$c" ;;
@CodeShane
CodeShane / devops_best_practices.md
Created February 16, 2020 18:44 — forked from jpswade/devops_best_practices.md
Devops Best Practices Checklist

Find the original here article here: Devops Best Practices

DevOps started out as "Agile Systems Administration". In 2008, Andrew Shafer did a talk called "Agile Infrastucture" addressing issues around involving more of the company in the same disciplines as programmers.

In 2009, Patrick Debois created "DevOpsDays" conference to help to bring it to light. However, it wouldn't begin to trend until about 2010, when people would begin to describe it as a standalone discipline.

Today, DevOps goes beyond just developers, systems administration and infrastructure, its about [dev, ops, agile, cloud

@CodeShane
CodeShane / ca.md
Created May 13, 2020 16:37 — forked from soarez/ca.md
How to setup your own CA with OpenSSL

How to setup your own CA with OpenSSL

For educational reasons I've decided to create my own CA. Here is what I learned.

First things first

Lets get some context first.

@CodeShane
CodeShane / svn.md
Created May 25, 2020 22:24 — forked from kidpixo/svn.md
Subversion Cheatsheet in Multimardkdown
@CodeShane
CodeShane / iptables-reload.sh
Created July 14, 2020 17:37 — forked from tehmoon/iptables-reload.sh
IPtables and docker reload!
#!/bin/sh
set -e
## SEE https://medium.com/@ebuschini/iptables-and-docker-95e2496f0b45
CWD=$(cd "$(dirname "${0}")"; pwd -P)
FILE="${CWD}/$(basename "${0}")"
chown root:root "${FILE}"
chmod o-rwx "${FILE}"
@CodeShane
CodeShane / unit.sh
Created June 24, 2021 21:26 — forked from ptc-mrucci/unit.sh
Bash test: get the directory of a script
#!/bin/bash
tmp=$(python -c "import os, sys; print(os.path.realpath('/tmp'))")
function test {
MESSAGE=$1
RECEIVED=$2
EXPECTED=$3
if [ "$RECEIVED" = "$EXPECTED" ]; then
@CodeShane
CodeShane / unit.sh
Created June 24, 2021 21:27 — forked from tvlooy/unit.sh
Bash test: get the directory of a script
#!/bin/bash
function test {
MESSAGE=$1
RECEIVED=$2
EXPECTED=$3
if [ "$RECEIVED" = "$EXPECTED" ]; then
echo -e "\033[32m✔︎ Tested $MESSAGE"
else