This file contains hidden or 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
| class Pet: | |
| attributes = ['name', 'birthday', 'weight'] | |
| def __init__(self, **args): | |
| for attr in self.attributes: | |
| setattr(self, attr, args.get(attr, None)) | |
| class Dog(Pet): | |
| dog_attributes = ['breed', 'tricks'] | |
| def __init__(self, **args): | |
| Pet.__init__(self, **args) |
This file contains hidden or 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 | |
| import sys | |
| def main(): | |
| if len(sys.argv[1:]) < 2: | |
| usage() | |
| elif sys.argv[1] == '-d' or sys.argv[1] == '--decode': | |
| decode(sys.argv[2:]) | |
| elif sys.argv[1] == '-e' or sys.argv[1] == '--encode': | |
| encode(" ".join(sys.argv[2:])) |
This file contains hidden or 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
| require 'thor' | |
| module PasswordListGenerators | |
| class BellDefaultWifiPasswords < Thor | |
| CHAR_ARRAY = [*'0'..'9', *'A'..'F'].freeze | |
| TOTAL_PASSWDS = (CHAR_ARRAY.count ** 8).freeze | |
| desc 'generate PATH', 'Generates the password list at the specified path' | |
| def generate(path = 'bell_default_wifi_passwords.txt') |
This file contains hidden or 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
| # /lib/tasks/db.rake | |
| namespace :db do | |
| desc "Truncate all table unless running production" | |
| task :truncate => :environment do | |
| abort("The Rails environment is running in production mode!") if Rails.env.production? | |
| ActiveRecord::Base.logger = Logger.new(STDOUT) | |
| connection = ActiveRecord::Base.connection | |
| connection.execute("SET FOREIGN_KEY_CHECKS=0;") | |
| tables = connection.execute("SHOW TABLES").map{|r| r[0]} |
This file contains hidden or 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
| $.fn.dataTableExt.oApi.reload = function(options) { | |
| this.fnFilter(options['search']) | |
| this.fnPageChange(options['page']) | |
| } |
This file contains hidden or 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
| # app/controllers/application_controller.rb | |
| class ApplicationController < ActionController::Base | |
| include Devise::Redirects | |
| # Prevent CSRF attacks by raising an exception. | |
| # For APIs, you may want to use :null_session instead. | |
| protect_from_forgery with: :exception | |
| include Locale | |
| end |
This file contains hidden or 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
| # config/application.rb | |
| module YourApp | |
| class Application < Rails::Application | |
| # ... | |
| # Auto load lib folder | |
| config.autoload_paths << Rails.root.join('lib') | |
| end | |
| end |
This file contains hidden or 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
| # Add . "$HOME/.bash_ps1" to .bashrc | |
| export PS1='¯\_(ツ)_/¯\w$ ' |
This file contains hidden or 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 | |
| # ~/bin/sba_systems_check | |
| systemctl status mysql --no-pager | |
| systemctl status redis_6379 --no-pager | |
| systemctl status elasticsearch --no-pager |
This file contains hidden or 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
| # lib/tasks/localtunnel.rake | |
| namespace :localtunnel do | |
| desc "Starts the LocalTunnel instace" | |
| task start: :environment do | |
| begin | |
| if Rails.env.production? | |
| raise "Trying to launch Localtunnel in production".red | |
| end | |
| default_subdomain = "whatever" | |
| default_port = 3000 |