Skip to content

Instantly share code, notes, and snippets.

Avatar

Justin Swanson geeksunny

View GitHub Profile
@geeksunny
geeksunny / supersu-install.sh
Created Sep 22, 2018
Commands executed in an attempt to manually install SuperSU 2.82 SR5 on AndroidThings 1.0.4. The resulting su binary is unable to write to the filesystem after adb remount.
View supersu-install.sh
cd ~/Downloads/SuperSU-2.82-SR5
adb connect [IP_ADDRESS]:5555
adb root
adb remount
adb push common/install-recovery.sh /system/etc/install-recovery.sh
adb shell chmod 0755 /system/etc/install-recovery.sh
adb shell chcon u:object_r:toolbox_exec:s0 /system/etc/install-recovery.sh
adb shell ln -s /system/etc/install-recovery.sh /system/bin/install-recovery.sh
View PwntDNS.py
import json
import requests
#
class ApiResponse(object):
statusCode = 0
body = {}
#
def __init__(self, statusCode, body):
self.statusCode = statusCode
@geeksunny
geeksunny / bind9_docker-compose.yml
Last active Aug 9, 2016
Docker compose file for launching a bind9 image with a separate volume for configuration files.
View bind9_docker-compose.yml
bind9-data:
image: emsi/bind9-data
bind9:
image: emsi/bind9
volumes_from:
- emsi/bind9-data
ports:
- "53:53"
- "53:53/udp"
@geeksunny
geeksunny / find_replace.py
Created Oct 14, 2013
A quick'n'dirty Python script to make find & replace operations on large text files fast and automated. Creates a duplicate file copy and leaves the original file unchanged.
View find_replace.py
#!/usr/bin/python
## Configuration ##
__target_file__ = "example.txt" # Relative path to the target file to process.
__find__ = "found" # Block of text to find.
__replace__ = "replaced" # Block of text to replace with.
###################
with open(__target_file__) as file_in: # Open source file for reading.
file_out = open(__target_file__+"_replaced", 'w') # Open destination file for writing.
for line in file_in: # Loop through source, line by line.
new_line = line.replace(__find__,__replace__) # Perform find & replace on current line.
@geeksunny
geeksunny / ssh_tunnel.py
Created Oct 14, 2013
A quick'n'dirty Python script for starting / stopping a port-forwarded SSH tunnel.
View ssh_tunnel.py
#!/usr/bin/python
import os # For running system commands.
import argparse # For command-line argument parsing.
## Configuration ##
__command__ = "ssh -L [LOCAL PORT]:127.0.0.1:[REMOTE PORT] [USER]@[REMOTE HOST] -f -N"
###################
## TODO ##
# * Build out the argparse system to parameterize the connection details.
@geeksunny
geeksunny / gist:5986271
Created Jul 12, 2013
A simple jQuery-based tooltip solution.
View gist:5986271
$('.tooltip')
.mouseenter(function(e) {
e.preventDefault();
pos = $(this).offset();
$(this).append('<div class="tooltip">'+$(this).attr('rel')+'</div>');
div = $('div.tooltip',$(this));
div.attr('top',pos['top']+5).attr('left',pos['left']).fadeIn(200);
})
.mouseleave(function(e) {
e.preventDefault();
@geeksunny
geeksunny / class.facebook_connect.php
Last active Dec 10, 2015
A simple class for interfacing with the Facebook API.
View class.facebook_connect.php
<?php
/* // EXAMPLE CODE!!!
error_reporting("E_ALL");
ini_set('display_errors', '1');
//session_start();$_SESSION = '';var_dump($_SESSION);die; // RESET SESSION
// Facebook App credentials
$app_id = "xxxxxxxxxxxxxxx";
$app_secret = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
$my_url = "http://xxx.xxx.xxx/xxx.xxx";
@geeksunny
geeksunny / class.urlstring.php
Created Jan 6, 2013
A simple class for handling URL strings for links.
View class.urlstring.php
<?php
class urlstring {
private $params = array();
function __construct() {
// Pulling parameters from the URL string.
$str = explode("&",$_SERVER['QUERY_STRING']);
foreach ($str as $item) {
$split = explode("=",$item);
$this->params[$split[0]] = $split[1];
@geeksunny
geeksunny / class.yelp.php
Created Jan 6, 2013
A simple class for interfacing with the Yelp API.
View class.yelp.php
<?php
//error_reporting("E_ALL");
//ini_set('display_errors', '1');
// ~~~ EXAMPLE CODE ~~~ //
/*
// Set your keys here
$consumer_key = "xxxxxxxxxxxxxxxxxxxxx";
$consumer_secret = "xxxxxxxxxxxxxxxxxxxxxxxxxx";
$token = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
@geeksunny
geeksunny / class.pagination.php
Last active Dec 10, 2015
Simple class for generating pagination links.
View class.pagination.php
<?php
class pagination {
private $forward = true;
private $backward = true;
private $current_page;
private $last_page;
function __construct($current_page=false, $last_page=false, $generate=false) {
if ($current_page) {
$this->current_page = $current_page;