Skip to content

Instantly share code, notes, and snippets.

@gsaslis
gsaslis / virtualbox_cleanup.sh
Created May 31, 2017 09:47
Bash script to cleanup Virtualbox VMs you might have lying around.
#!/usr/bin/env bash
SAVEIFS=$IFS # save old IFS value
IFS=$'\n' # make newlines the only separator
echo "Powering off all running VMs"
for vm in $(VBoxManage list runningvms | awk '{print substr($2, 2, length($2) - 2)}') # you might want to limit your search by `| grep 'some vm name here' ` *before* the pipe to awk
do
echo "Powering off VM ${vm}"
VBoxManage controlvm ${vm} poweroff
echo "VM ${vm} powered off"
@developius
developius / README.md
Last active May 20, 2025 11:20
Setup SSH keys for use with GitHub/GitLab/BitBucket etc

Create a new repository, or reuse an existing one.

Generate a new SSH key:

ssh-keygen -t rsa -C "your_email@example.com"

Copy the contents of the file ~/.ssh/id_rsa.pub to your SSH keys in your GitHub account settings (https://github.com/settings/keys).

Test SSH key:

@lrvick
lrvick / sync-repos.sh
Last active July 25, 2022 06:15
Locally sync all Github repos & branches for user/org
#!/bin/bash
USER='lrvick'
ACCESS_TOKEN='YOUR_TOKEN_HERE'
API="https://api.github.com/orgs"
ENDPOINT="/${USER}/repos?per_page=200&access_token=${ACCESS_TOKEN}"
FOLDER='/home/lrvick/Sources'
REPO_NAMES=$( curl -s "${API}${ENDPOINT}" | \
grep \"name\" | sed 's/ \"name\": \"\(.*\)\",/\1/g'
#!/bin/bash
# Filename: boot_prompt.sh
# Description: Shows connected interface(s) at boot and related ip address(es) on tty login prompt
# Usage: Put it somewhere (ie. /etc/init.d/) and then add its full path entry to /etc/rc.d/rc.local
#
# Author: marco[dot]agate@gmail[dot]com
# Version: 201304051644
DSTFILE="/etc/issue"
KEEPLINE=$(head -n 1 ${DSTFILE})
@573
573 / gist:3907478
Created October 17, 2012 19:10
~/.bashrc file for using *.bashrc files inside a ~/.bashrc.d folder to load different stuff for a shell session - environment etc.
# To pick up the latest recommended .bashrc content,
# look in /etc/defaults/etc/skel/.bashrc
# Modifying /etc/skel/.bashrc directly will prevent
# setup from updating it.
# The copy in your home directory (~/.bashrc) is yours, please
# feel free to customise it to create a shell
# environment to your liking. If you feel a change
# would be benificial to all, please feel free to send
@deepankarsharma
deepankarsharma / modern_opengl_02_bunny.py
Created August 28, 2012 03:03
Stanford bunny drawn using Python and modern OpenGL
from glfwpy.glfw import *
from glfwpy.utils.obj_loader import ObjGeometry
import sys
from OpenGL.GL import *
from OpenGL.arrays import ArrayDatatype
import time
vertex = """
#version 330
in vec3 vin_position;
@deepankarsharma
deepankarsharma / modern_opengl_01_triangle.py
Created August 28, 2012 01:50
Modern opengl using Python
from glfwpy.glfw import (AUTO_POLL_EVENTS, OPENED, OPENGL_CORE_PROFILE,
OPENGL_FORWARD_COMPAT, OPENGL_PROFILE, OPENGL_VERSION_MAJOR,
OPENGL_VERSION_MINOR, WINDOW,
Enable, GetWindowParam, Init, OpenWindow, OpenWindowHint,
SetKeyCallback, SetWindowTitle, SwapBuffers, Terminate)
import numpy as np
from OpenGL.arrays import ArrayDatatype
from OpenGL.GL import (GL_ARRAY_BUFFER, GL_COLOR_BUFFER_BIT,
GL_COMPILE_STATUS, GL_FALSE, GL_FLOAT, GL_FRAGMENT_SHADER,
GL_LINK_STATUS, GL_RENDERER, GL_SHADING_LANGUAGE_VERSION,
@jterrace
jterrace / shaper.sh
Created February 23, 2012 21:13
A utility script for traffic shaping with tc
#!/bin/bash
#
# shaper.sh
# ---------
# A utility script for traffic shaping using tc
#
# Usage
# -----
# shape.sh start - starts the shaper
# shape.sh stop - stops the shaper
@jterrace
jterrace / remove_dup_tris.py
Created November 3, 2011 19:27
Removing duplicate triangles with numpy
import numpy as np
def remove_duplicates(array_data, return_index=False, return_inverse=False):
"""Removes duplicate rows of a multi-dimensional array. Returns the
array with the duplicates removed. If return_index is True, also
returns the indices of array_data that result in the unique array.
If return_inverse is True, also returns the indices of the unique
array that can be used to reconstruct array_data."""
unique_array_data, index_map, inverse_map = np.unique(
array_data.view([('', array_data.dtype)] * \
@bengolder
bengolder / gist:1057297
Created June 30, 2011 21:34
Least Cost Path on mesh using NetworkX in Rhino
# import the sys and os libraries for adding modules
import sys
import os
# import the Rhino library
import Rhino
# manually write out the path to the folder
# where networkx is stored, as a list of strings
pathbits = [