Skip to content

Instantly share code, notes, and snippets.

@santaklouse
santaklouse / angular imagesPreloader directive
Last active September 3, 2016 23:28
Angular 1.* ; Preloads images in background by using valid css (when in $rootScope 'imgLoading' event emitted and value is false)
//using Lodash (https://lodash.com/)
.directive('imagesPreloader', ['$rootScope', function($rootScope) {
return {
restrict: 'A',
link: function($scope) {
var willBePreloaded,
preloadedHashes = {},
imagesUrls = [];
var findInPreloaded = function(obj) {
@santaklouse
santaklouse / angular imagePreload service
Created September 3, 2016 23:52
Angular 1.* ; Preloads images in background by using js (using lodash https://lodash.com/)
.service('imagePreload', ['$filter', 'createHeadLink', 'hash', function($filter, createHeadLink, hash) {
var preloadedHashes = {},
notLoaded = {},
findInPreloaded = function(obj) {
return preloadedHashes[hash(obj.id)] && preloadedHashes[hash(obj.id)] === obj.src;
},
isShouldBePreloaded = function(obj) {
return obj && obj.src && !findInPreloaded(obj);
},
addPreloaded = function(obj) {
@santaklouse
santaklouse / gist:5e83c16cbe1bccf30f062b0dd33b8f90
Created April 30, 2017 20:07
JS copy To Clipboard (prevent coping/cutting programmatically)
// Copies a string to the clipboard. Must be called from within an
// event handler such as click. May return false if it failed, but
// this is not always possible. Browser support for Chrome 43+,
// Firefox 42+, Safari 10+, Edge and IE 10+.
// IE: The clipboard feature may be disabled by an administrator. By
// default a prompt is shown the first time the clipboard is
// used (per session).
function copyToClipboard(text) {
if (window.clipboardData && window.clipboardData.setData) {
// IE specific code path to prevent textarea being shown while dialog is visible.
#!/bin/bash /usr/lib/turtle/turtle_module
VERSION="0.9"
DESCRIPTION="TORtle - TOR Turtle Gateway + TOR hidden SHELL/Service"
AUTHOR="Original by shad - customized by GermanNoob"
CONF="/tmp/tortle.form"
: ${DIALOG_OK=0}
: ${DIALOG_CANCEL=1}
: ${DIALOG_HELP=2}
: ${DIALOG_EXTRA=3}
@santaklouse
santaklouse / HowToOTG.md
Created November 14, 2017 10:50 — forked from gbaman/HowToOTG.md
Simple guide for setting up OTG modes on the Raspberry Pi Zero

Raspberry Pi Zero OTG Mode

Simple guide for setting up OTG modes on the Raspberry Pi Zero - By Andrew Mulholland (gbaman).

The Raspberry Pi Zero (and model A and A+) support USB On The Go, given the processor is connected directly to the USB port, unlike on the B, B+ or Pi 2 B, which goes via a USB hub.
Because of this, if setup to, the Pi can act as a USB slave instead, providing virtual serial (a terminal), virtual ethernet, virtual mass storage device (pendrive) or even other virtual devices like HID, MIDI, or act as a virtual webcam!
It is important to note that, although the model A and A+ can support being a USB slave, they are missing the ID pin (is tied to ground internally) so are unable to dynamically switch between USB master/slave mode. As such, they default to USB master mode. There is no easy way to change this right now.
It is also important to note, that a USB to UART serial adapter is not needed for any of these guides, as may be documented elsewhere across the int

@santaklouse
santaklouse / blueborne-nexus5.py
Created November 17, 2017 04:39 — forked from jesux/blueborne-nexus5.py
Blueborne RCE PoC - Nexus5 6.0.1
import os
import sys
import time
import struct
import select
import binascii
import bluetooth
from bluetooth import _bluetooth as bt
@santaklouse
santaklouse / sshd_tunnel.sh
Created March 2, 2018 14:30 — forked from ripper/sshd_tunnel.sh
A script to launch user sshd limited to creation of reverse tunnels
#!/bin/sh
AUTHORIZED_KEYS=authorized_keys
HOST_RSA_KEY=ssh_host_rsa_key
SSHD=/usr/sbin/sshd
PORT=8443
case "$AUTHORIZED_KEYS" in /*) ;; *) AUTHORIZED_KEYS=$PWD/$AUTHORIZED_KEYS ;; esac
case "$HOST_RSA_KEY" in /*) ;; *) HOST_RSA_KEY=$PWD/$HOST_RSA_KEY ;; esac
@santaklouse
santaklouse / get_ip_address.sh
Created May 2, 2018 18:40
bash command (script) for retrieving ip address of interface
#!/bin/bash
IFACE=$1||'eth0'
ip addr show $IFACE|fgrep 'inet '| xargs|cut -d' ' -f2
@santaklouse
santaklouse / README.md
Last active March 27, 2020 00:02
Bash script for making and save screenshots to IPFS, cover with goo.gl link shortener (Linux, macOS). Running IPFS daemon required.
@santaklouse
santaklouse / services.js
Last active September 11, 2018 16:33
AngularJS services example
(function(angular) {
'use strict';
angular.module('noname.services', ['ngResource'])
.factory('templateUrl', ['$templateCache', 'config', 'feature', function($templateCache, config, feature) {
return function(placement, name) {
var templatePath = function(role) {
var path;