Skip to content

Instantly share code, notes, and snippets.

View mikeckennedy's full-sized avatar

Michael Kennedy mikeckennedy

View GitHub Profile
@benbalter
benbalter / conditionally-load-jquery.js
Created April 4, 2011 18:05
Conditionally Load jQuery
// Conditionally Load jQuery (javascript)
// Source: https://gist.github.com/gists/902090/
var init, maybeLoadJq;
init = function() {
jQuery(document).ready(function() {
alert('Your Code Here');
});
};
@mdellavo
mdellavo / pyramid-rest-mongodb-app.py
Created January 21, 2012 17:40
A Pyramid app to implement a simple RESTful resource in MongoDB. Currently only GET implemented.
from pyramid.config import Configurator
from pyramid.view import view_config
import json
import logging
import datetime
log = logging.getLogger(__name__)
from webservice.model import Session, Machine, LogFile, LogMessage
@henryalee
henryalee / MongoDB Install and AutoStart
Last active November 21, 2017 03:20
Install mongodb with homebrew and set it to autostart
brew install mongo
mkdir -p ~/Library/LaunchAgents
cp /usr/local/Cellar/mongodb/2.2.0-x86_64/homebrew.mxcl.mongodb.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.mongodb.plist
# Mongo might be named differently, try this
cp /usr/local/Cellar/mongodb**/**/*plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/*mongo*plist
@etienned
etienned / extractdocx.py
Last active November 21, 2022 13:56
Simple function to extract text from MS XML Word document (.docx) without any dependencies.
try:
from xml.etree.cElementTree import XML
except ImportError:
from xml.etree.ElementTree import XML
import zipfile
"""
Module that extract text from MS XML Word document (.docx).
(Inspired by python-docx <https://github.com/mikemaccana/python-docx>)
@BlakeGardner
BlakeGardner / compact.js
Last active October 10, 2024 11:19
Compact all collections inside of a MongoDB database
// This script loops though the list of collection names in a MongoDB and runs the compact operation on them
// Simply paste this into the Mongo shell
use testDbName;
db.getCollectionNames().forEach(function (collectionName) {
print('Compacting: ' + collectionName);
db.runCommand({ compact: collectionName });
});
@alirobe
alirobe / reclaimWindows10.ps1
Last active November 15, 2024 12:08
This Windows 10 Setup Script turns off a bunch of unnecessary Windows 10 telemetery, bloatware, & privacy things. Not guaranteed to catch everything. Review and tweak before running. Reboot after running. Scripts for reversing are included and commented. Fork of https://github.com/Disassembler0/Win10-Initial-Setup-Script (different defaults). N.…
###
###
### UPDATE: For Win 11, I recommend using this tool in place of this script:
### https://christitus.com/windows-tool/
### https://github.com/ChrisTitusTech/winutil
### https://www.youtube.com/watch?v=6UQZ5oQg8XA
### iwr -useb https://christitus.com/win | iex
###
###
from os import listdir
from os.path import isfile, join
import re
import matplotlib.pyplot as plt
import numpy as np
path = 'transcripts'
@Dexdev08
Dexdev08 / talk_python_similarities.csv
Created June 5, 2016 14:36
Talk Python Cosine Similarity Scores
index file2 similarity file1
0 027.txt 0.870699976021 001.txt
1 038.txt 0.86203984054 001.txt
2 045.txt 0.83739929573 001.txt
3 048.txt 0.871940130115 001.txt
4 007.txt 0.839339858402 001.txt
5 009.txt 0.849677851534 001.txt
6 004.txt 0.830406980293 001.txt
7 006.txt 0.878178563493 001.txt
8 031.txt 0.850476330623 001.txt
@Dexdev08
Dexdev08 / talk_python_similarities.py
Created June 7, 2016 13:46
Copy from local Ipython Notebook to derive similarity scores of Talk Python Transcripts
import graphlab as gl
import pandas
import numpy as np
import string
import re
import unicodedata
import math
# attempt to load text files
import os
files = os.listdir(os.getcwd())
@ewenchou
ewenchou / README.md
Last active July 8, 2023 04:36
Run Python script as systemd service
  1. Create a service file like dash_sniffer.service
  2. Put it in /lib/systemd/system/
  3. Reload systemd using command: systemctl daemon-reload
  4. Enable auto start using command: systemctl enable dash_sniffer.service