POST /oauth/token HTTP/1.1
Content-Type: application/json
{
"grant_type": "password",
"client_id": "CLIENT_ID",
"owner_type": "OWNER_TYPE",
"username": "OWNER_EMAIL",
"password": "OWNER_PASSWORD"
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 1. Clear retry set | |
Sidekiq::RetrySet.new.clear | |
# 2. Clear scheduled jobs | |
Sidekiq::ScheduledSet.new.clear | |
# 3. Clear 'Processed' and 'Failed' jobs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# get a list of files which contain "require" AND "spec_helper" on a single line | |
# excluding spec/rails_helper.rb (we want "require 'spec_helper'" to exist here) | |
declare -a files=$(git grep -E "require.*spec_helper" | cut -d ':' -f 1 | grep -v 'spec/rails_helper.rb') | |
# loop through files and replace "spec_helper" with "rails_helper" | |
for i in $files; do | |
sed -i '' -e 's/spec_helper/rails_helper/' $i | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# A Ruby script to delete files older than X days in a given directory. Pretty simple. | |
# Like this: file_control.rb /User/pelgrim/Documents '*.pdf' 7 | |
# The command above you remove ALL your pdfs inside Documents older than SEVEN DAYS. | |
# Quickly written by pelgrim < guskald at gmail dot com > | |
unless ARGV.size == 3 | |
puts "Usage: file_control <directory> <filename pattern> <max age>" | |
exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env ruby | |
filenames = Dir["app/models/*.rb"] | |
filenames.each do |file_name| | |
next if file_name.include? 'application_record.rb' | |
text = File.read(file_name) | |
new_contents = text.gsub(/< ActiveRecord::Base/, "< ApplicationRecord") | |
if text != new_contents | |
p "changing #{file_name}" | |
# To merely print the contents of the file, use: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# include in Ruby / Active Record class | |
# | |
# include MethodLogger | |
# logger_name("ticket_logger") | |
# | |
# use as a standard rails logger | |
# ticket_logger.info(" Events Processed: #{events_processed}") | |
# ticket_logger.error(e.inspect) | |
# | |
# TODO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# this needs to be run in crrent process with the "dot" command | |
# . create_vim.sh ims|opc | |
tabname=$1 | |
printf "\e]1;${1-$(basename `pwd`)}\a" | |
case $tabname in | |
ims) | |
cd '/Users/xxxxxx/Sites/tayda/tayda_inventory' | |
;; | |
opc) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import logging | |
import datetime | |
from time import sleep | |
from gpiozero import MotionSensor | |
pir = MotionSensor(4, pull_up=True, sample_rate=200, threshold=0.2) | |
logging.basicConfig(filename='optical-sensor.log',level=logging.DEBUG) | |
datetime_set = False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# you need to install dependent programs and utilities such as speedtest-cli, a command line interface program that tests your bandwidth speeds via speedtest.net | |
import os | |
import sys | |
import csv | |
import datetime | |
import time | |
import twitter | |
def test(): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create Rails App | |
``` | |
rails new app_name -d mysql | |
``` | |
### cp config/database.example.yml | |
``` | |
rake db:create | |
``` |
OlderNewer