Skip to content

Instantly share code, notes, and snippets.

View josephrexme's full-sized avatar
:octocat:
Training wolves and dragons

Joseph Rex josephrexme

:octocat:
Training wolves and dragons
View GitHub Profile
#!/usr/bin/python
import re
from sys import argv
import socket
import mechanize
import scapy
script, arg1, arg2 = argv
# Taken 2 arguments for the network packet sniffer
<?php
/**
* Get human readable time difference between 2 dates
*
* Return difference between 2 dates in year, month, hour, minute or second
* The $precision caps the number of time units used: for instance if
* $time1 - $time2 = 3 days, 4 hours, 12 minutes, 5 seconds
* - with precision = 1 : 3 days
* - with precision = 2 : 3 days, 4 hours
@josephrexme
josephrexme / SassMeister-input.sass
Created June 9, 2014 12:32
Generated by SassMeister.com.
// ----
// Sass (v3.3.8)
// Compass (v1.0.0.alpha.19)
// ----
=box-sizing($value)
-webkit-box-sizing: $value
-moz-box-sizing: $value
box-sizing: $value
@josephrexme
josephrexme / SassMeister-input.sass
Created June 13, 2014 17:59
Generated by SassMeister.com.
// ----
// Sass (v3.3.8)
// Compass (v1.0.0.alpha.19)
// ----
.grid-inner address
@extend #tiles li .overview p
.grid-inner address:before
content: "~ "

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

Keybase proof

I hereby claim:

  • I am josephrexme on github.
  • I am josephrexme (https://keybase.io/josephrexme) on keybase.
  • I have a public key ASBa0d3rxEv4t-TsMIGRPL5ZZGKgpq0G0Q2c2PkSrZe1Ego

To claim this, I am signing this object:

@josephrexme
josephrexme / _helpers.scss
Last active August 29, 2015 14:11
rake assets precompile failure
/* ==========================================================================
* Helper classes
* ========================================================================== */
//@import "variables";
/* Image replacement */
.ir {
background-color: transparent;
border: 0;
overflow: hidden;
/* IE 6/7 fallback */
@josephrexme
josephrexme / .htaccess
Created December 22, 2014 12:40
htaccess for apache web servers using PHP frameworks like Laravel
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]
@josephrexme
josephrexme / company.html.erb
Last active August 29, 2015 14:12
First argument in form cannot be nil error
<div class="content pad10">
<%= form_for @department do |f| %>
<p>
<%= f.label :department, 'Department Name' %>
<%= f.text_field 'department' %>
</p>
<p>
<%= f.label :parent %>
<% department_array = @departments.all.map { |department| [department.name, department.id + 1] } %>
<%= f.select :parent, options_for_select(department_array) %>
@josephrexme
josephrexme / dashboard_controller.rb
Created December 23, 2014 23:15
How I display a list of child departments on my dashboard index
class DashboardController < ApplicationController
before_action :require_login
before_filter :init
def index
@departments.each do |department|
childfetch = Department.where(parent: "#{department.name}").select('name')
instance_variable_set("@#{department.name}Children".gsub(' ','_'), childfetch.map { |child| "#{child.name}" }.join(',') )
end
end