Skip to content

Instantly share code, notes, and snippets.

Eriks Vitolins evitolins

View GitHub Profile
@evitolins
evitolins / docker_aliases.sh
Last active Feb 21, 2019
Helpful aliases to interact with Docker
View docker_aliases.sh
# ------------------------------------
# Docker Aliases
# ------------------------------------
# Get latest container ID
alias dl="docker ps -l -q"
# Get running containers
alias dps="docker ps"
# Get all containers
@evitolins
evitolins / new_user.sh
Created Jan 29, 2019
Create a new Linux User w/ default SSH files
View new_user.sh
NEWUSER="my_new_user"
sudo mkdir -p /home/${NEWUSER}/.ssh && \
sudo touch /home/${NEWUSER}/.ssh/authorized_keys && \
sudo useradd -d /home/${NEWUSER} ${NEWUSER} && \
sudo usermod -aG sudo ${NEWUSER} && \
sudo chown -R ${NEWUSER}:${NEWUSER} /home/${NEWUSER}/ && \
sudo chown root:root /home/${NEWUSER} && \
sudo chmod 700 /home/${NEWUSER}/.ssh && \
sudo chmod 644 /home/${NEWUSER}/.ssh/authorized_keys
View adarkroom
## Save Point
eyJ2ZXJzaW9uIjoxLjMsImZlYXR1cmVzIjp7ImxvY2F0aW9uIjp7InJvb20iOnRydWUsIm91dHNpZGUiOnRydWUsIndvcmxkIjp0cnVlfX0sInN0b3JlcyI6eyJ3b29kIjozMiwiZnVyIjo1MDAxLCJiYWl0IjoxNjQ3LCJ0ZWV0aCI6NjMsInNjYWxlcyI6MTA4LCJtZWF0IjoyNTUsImNsb3RoIjoxMjcsImNoYXJtIjo2LCJsZWF0aGVyIjozMDY3LCJjdXJlZCBtZWF0IjoxNiwiY29tcGFzcyI6MSwidG9yY2giOjEwLCJib25lIHNwZWFyIjowLCJ3YXRlcnNraW4iOjEsInJ1Y2tzYWNrIjoxLCJsIGFybW91ciI6MSwiaXJvbiI6MzI0NSwiYm9sYXMiOjAsImNhc2siOjEsIndhZ29uIjoxLCJpIGFybW91ciI6MSwiaXJvbiBzd29yZCI6MSwibWVkaWNpbmUiOjAsInN0ZWVsIHN3b3JkIjoxLCJzdGVlbCI6Mjc2LCJyaWZsZSI6MCwiYnVsbGV0cyI6MSwiZ3JlbmFkZSI6MCwibGFzZXIgcmlmbGUiOjAsImVuZXJneSBjZWxsIjowLCJiYXlvbmV0IjowLCJ0cmFwIjowLCJjYXJ0IjowLCJodXQiOjAsImxvZGdlIjowLCJ0cmFkaW5nIHBvc3QiOjAsInRhbm5lcnkiOjAsInNtb2tlaG91c2UiOjAsIndvcmtzaG9wIjowLCJzdGVlbHdvcmtzIjowLCJhcm1vdXJ5IjowLCJ3YXRlciB0YW5rIjoxLCJjb252b3kiOjEsInMgYXJtb3VyIjoxLCJjb2FsIjo0OX0sImNoYXJhY3RlciI6eyJwdW5jaGVzIjo1LCJzdGFydmVkIjoyLCJkZWh5ZHJhdGVkIjoxLCJwZXJrcyI6eyJzY291dCI6dHJ1ZX19LCJpbmNvbWUiOnsiZ2F0aGVyZXIiOnsiZGVsYXkiOjEwL
View maya_subdivide_joints.py
import maya.cmds as cmds
'''
Split joint chain between 2 joints (parent/child).
Usage Example:
jnts = cmds.ls(selection=True, type='joint')
View animschool_video_bonus_controls.js
var v = $('#video_html5_api')[0];
var offsetTime = function (video, offset) {
video.currentTime = (video.currentTime + offset);
};
var c = document.createElement('div');
c.style.position="absolute";
c.style.top="0";
c.style.right="0";
var createButton = function (video, label, offset) {
var b = document.createElement("button");
@evitolins
evitolins / selectExportables.mel
Created Oct 26, 2017
Quickly select exportable items (joints and mesh belonging to skin clusters)
View selectExportables.mel
proc string[] getTransform(string $shape[]) {
string $transform[];
for ($node in $shape) {
if ( "transform" != `nodeType $node` ) {
// If given node is already a transform, just pass on through
string $parents[] = `listRelatives -fullPath -parent $node`;
appendStringArray($transform, $parents, size($parents));
}
}
return $transform;
@evitolins
evitolins / gistbox_scrape.js
Created Oct 26, 2017
Grab your gistBox urls and associated labels into JSON
View gistbox_scrape.js
// Run this in the JS console, after logging into your GistBox
var gists = app.gists.models;
var data = [];
var i, ii, g, l;
for (i=0; i<gists.length; i++) {
gist = gists[i];
g = {};
g.id = gist.id;
g.url = gist.attributes.link_url;
@evitolins
evitolins / simple_flex_grid.css
Created Jun 18, 2017
A simple responsive grid using flexbox
View simple_flex_grid.css
.grid .cell {
position: relative;
margin: 1rem 1rem 2rem;
}
@media screen and (min-width: 600px) {
.grid {
display: flex;
flex-wrap: wrap;
flex-direction: row;
@evitolins
evitolins / html5_video_events.js
Created Apr 6, 2017
Attach alerts for every video event available.
View html5_video_events.js
var video_events = {
'abort' : 'abort : The loading of an audio/video is aborted',
'canplay' : 'canplay : The browser can start playing the audio/video',
'canplaythrough' : 'canplaythrough : The browser can play through the audio/video without stopping for buffering',
'durationchange' : 'durationchange : The duration of the audio/video is changed',
'emptied' : 'emptied : The current playlist is empty',
'ended' : 'ended : The current playlist is ended',
'error' : 'error : An error occurred during the loading of an audio/video',
'loadeddata' : 'loadeddata : The browser has loaded the current frame of the audio/video',
'loadedmetadata' : 'loadedmetadata : The browser has loaded meta data for the audio/video',
@evitolins
evitolins / find_stuff.sh
Last active Apr 10, 2017
Helpful Find Commands
View find_stuff.sh
# Find all files with uppercase extensions
find . -type f -regex '.*\.[A-Z]\{1,\}'
# Count all files with uppercase extensions
find . -type f -regex '.*\.[A-Z]\{1,\}' | wc -l
# Find all file extensions that exceed 2MB
find . -type f -name "*.*" -size +2M | sed 's|.*\.||' | sort -u
You can’t perform that action at this time.