Skip to content

Instantly share code, notes, and snippets.

Avatar

James montj2

View GitHub Profile
@montj2
montj2 / fogcreek_apply.rb
Created Apr 28, 2014
The Fog Creek Dev Application Challenge @ http://www.fogcreek.com/Jobs/Dev/
View fogcreek_apply.rb
hash = 910897038977002
letters = "acdegilmnoprstuw"
answer = ""
9.times do |x| #9 letter string loop
remainder = hash % 37 #get the remainder for lookup
answer = answer + letters[remainder] #add letter to the answer
hash = (hash - remainder) / 37 #now we're evenly divisible
View gist:cc4d3640f4fafce55a65
var checkout_data = {
product : "",
variation:0,
flavour_set :true,
selected_flavour:"",
specific_flavours:[]
};
function navigate_step(step){
$(".one_button .step").removeClass("active");
$("#step"+step).addClass("active");
@montj2
montj2 / conn_test.py
Last active Oct 22, 2016
Python TCP port check
View conn_test.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import socket # socket module
import sys # exit method(s)
def check_server(address, port):
# Create TCP Socket
s = socket.socket()
@montj2
montj2 / spotlight_fix.sh
Created Aug 22, 2017
MacOS 10.9 - 10.13 Spotlight Reindexing Fix
View spotlight_fix.sh
#!/bin/bash
# Check for root/sudo
if [ "$(id -u)" != "0" ]; then
echo "This script should not be run using sudo or as the root user"
exit 1
fi
# Turn off indexing
@montj2
montj2 / tlp-stat_ac
Created Jan 12, 2020
TLP 1.3.0-beta.2 [AC]
View tlp-stat_ac
--- TLP 1.3.0-beta.2 --------------------------------------------
+++ Configured Settings:
TLP_ENABLE="1"
TLP_PERSISTENT_DEFAULT="0"
DISK_IDLE_SECS_ON_AC="0"
DISK_IDLE_SECS_ON_BAT="2"
MAX_LOST_WORK_SECS_ON_AC="15"
MAX_LOST_WORK_SECS_ON_BAT="60"
CPU_ENERGY_PERF_POLICY_ON_AC="balance_performance"
@montj2
montj2 / tlp-stat_batt
Created Jan 12, 2020
TLP 1.3.0-beta.2 [BATT]
View tlp-stat_batt
--- TLP 1.3.0-beta.2 --------------------------------------------
+++ Configured Settings:
TLP_ENABLE="1"
TLP_PERSISTENT_DEFAULT="0"
DISK_IDLE_SECS_ON_AC="0"
DISK_IDLE_SECS_ON_BAT="2"
MAX_LOST_WORK_SECS_ON_AC="15"
MAX_LOST_WORK_SECS_ON_BAT="60"
CPU_ENERGY_PERF_POLICY_ON_AC="balance_performance"