Skip to content

Instantly share code, notes, and snippets.

@boseji
boseji / runscript.py
Created February 24, 2014 05:00
Run Script to actually execute a Python script from inside a Python File
import os,sys,importlib
from os import path
def RunScript(sPath,sFile,bDirect=2):
''' Run a Python Script via differenct Methods
@param sPath Sting containing Only the
Absolute Path of the File to Execute
@param sFile String containing Only the File Name to Execute
@param bDirect Flag indicates how to run the Script
0 = Run using Exec Technique
1 = Run directly in Shell
@nedos
nedos / read_saleae.py
Last active April 6, 2018 15:44
This script parses a saleae csv export to generate a verilog simulation file (in picoseconds)
#!/usr/bin/python
import sys
import csv
def print_usage():
print "Usage: {} <csv_file>".format(sys.argv[0])
if len(sys.argv) != 2:
print "Not enough arguments"
print_usage()
@hexagon5un
hexagon5un / gcodesender.py
Created April 15, 2019 14:54
gcodesender.py with "improved" defaults
#!/usr/bin/python
"""\
Simple g-code streaming script
https://github.com/bborncr/gcodesender.py/blob/master/gcodesender.py
"""
import serial
import time
import argparse
#!/Library/Frameworks/Python.framework/Versions/3.6/bin/python3
import sys,os,fileinput
def main(argv):
for line in fileinput.input():
bytes = line.lstrip(".byte ").rstrip('\n').split(',')
print(".byte ", end="")
@ttscoff
ttscoff / copy.bash
Last active September 11, 2019 14:07
Intelligently copy command results, text file, or raw input/arguments to OS X clipboard
copy() {
if [[ $1 =~ ^-?[hH] ]]; then
echo "Intelligently copies command results, text file, or raw text to"
echo "OS X clipboard"
echo
echo "Usage: copy [command or text]"
echo " or pipe a command: [command] | copy"
return
fi
@ericelliott
ericelliott / gitclean.sh
Created January 31, 2016 04:57
gitclean.sh - cleans merged/stale branches from origin
git remote prune origin
git branch -r --merged master | egrep -iv '(master|develop)' | sed 's/origin\///g' | xargs -n 1 git push --delete origin
@blister
blister / gist:740829
Created December 14, 2010 18:19
Bash script to add a delay to the localhost interface on Linux machines
#!/bin/bash
# Copyright 2010 Eric Ryan Harrison <me@ericharrison.info>
# Inspired by:
# http://daniel.haxx.se/blog/2010/12/14/add-latency-to-localhost/
if [ -n "$1" ]
then
if [ "$1" = "off" ]
then
tc qdisc del dev lo root
@cliss
cliss / organize-photos.py
Created October 6, 2013 14:43
Photo management script. This script will copy photos from "~/Pictures/iPhone Incoming" into a tree the script creates, with folders representing month and years, and photo names timestamped. Completely based on the work of the amazing Dr. Drang; see here: http://www.leancrew.com/all-this/2013/10/photo-management-via-the-finder/ You can see more…
#!/usr/bin/python
import sys
import os, shutil
import subprocess
import os.path
from datetime import datetime
######################## Functions #########################
// Copyright (C) 2019, Dan Ravensloft
// SPDX-License-Identifier: GPL-3.0-or-later
library(74series) {
// 7400 quad 2-input NAND gate
cell(7400_4xNAND2) {
area: 3;
pin(A) { direction: input; }
pin(B) { direction: input; }
pin(Y) { direction: output; function: "(A*B)'"; }
}
@AdaRoseCannon
AdaRoseCannon / HTMLElementPlus.js
Last active March 3, 2023 11:33
HTML Element Plus for Web Components
'use strict';
class HTMLElementPlus extends HTMLElement {
static defaultAttributeValue() {
/* the name of the attribute is parsed in as a parameter */
return;
}
static parseAttributeValue(name, value) {