Skip to content

Instantly share code, notes, and snippets.

View natecraddock's full-sized avatar

Nathan Craddock natecraddock

View GitHub Profile
@natecraddock
natecraddock / project-stats.py
Last active May 11, 2021 17:03
A script to run file name statistics on project directories
"""Run in a directory containing multiple project directories
Or give a single path to analyze as an argument to the script.
"""
import math
import os
import sys
from dataclasses import dataclass
def walkdir(path, ignore=[], ignoreexts=[]):
// These are the functions I used for printing out the arrays
// And vectors. Maybe you will find them useful
void PrintIntVector(vector<int> vec) {
cout << "[";
for (unsigned i = 0; i < vec.size(); ++i) {
cout << vec.at(i);
if (i < vec.size() - 1) {
cout << ", ";
}
@natecraddock
natecraddock / random-int-example.cpp
Created February 23, 2021 17:41
Examples from class
#include <iostream>
#include <string>
#include <cstdlib> // for rand(), srand(), time()
using namespace std;
const int NUMBER = 10;
// Example of a generalized function to return a random int in a range
int RandIntInRange(int min, int max) {
// See zyBooks 5.15 for more info
@natecraddock
natecraddock / loops-example.cpp
Last active February 17, 2021 03:19
Examples of while, for, and do-while loops in c++ for CS 142
#include <iostream>
#include <string>
#include <limits> // For numeric_limits<streamsize>::max()
using namespace std;
int main() {
int number;
string name;
// This first example checks cin.fail() to see if the input was not
// ==UserScript==
// @name Phabricator Move Comment Box
// @version 1
// @match https://developer.blender.org/D*
// @description Move the phabricator comment form to a more reasonable location
// ==/UserScript==
// Util for inserting after nodes
function insertAfter(newNode, existingNode) {
existingNode.parentNode.insertBefore(newNode, existingNode.nextSibling);
"""
Example Usage
=============
A folder titled png_icons will be created in the current directory
Run as:
blender icons_geom.blend --background --python blender_icons_geom_png.py
import bpy
class RigLayers(bpy.types.Panel):
bl_idname = 'POSE_PT_RigLayers'
bl_label = "Rig Layers"
bl_space_type = "VIEW_3D"
bl_region_type = "UI"
bl_context = "posemode"
bl_category = 'CUSTOM_CATEGORY'
@natecraddock
natecraddock / directory-cat.py
Last active April 4, 2019 22:10
Copy all files in path to out.txt with filename headers
import os
path = "node-master"
out = open("out.txt", 'w')
for file in os.listdir(path):
in_file = open(os.path.join(path, file))
out.write(file)
# Audio Visualizer Script
# Load the script into blender
# Make sure Auto Run Python scripts is enabled in your
# User preferences for the drivers
# Enjoy!
import bpy
import bmesh
import mathutils

I'm documenting my setup for configuring my ThinkPad on Linux

Issues:

  • Brightness controls stop working (cinnamon.power) after suspend
  • Wireless (wifi) interface not found after suspend

Fixes:

  • Wireless problems (Ask Ubuntu Wifi doesn't work after suspend)
sudo systemctl restart network-manager.service