Skip to content

Instantly share code, notes, and snippets.

View nsa-yoda's full-sized avatar
🎯
Focusing

Juan Sanchez nsa-yoda

🎯
Focusing
View GitHub Profile
@nsa-yoda
nsa-yoda / CustomNumberedOL.html
Last active December 12, 2015 12:48
Custom numbered OL
<!DOCTYPE html>
<html>
<head>
<title>Styled OL Test</title>
<style>
ol { counter-reset: item; }
ol li { display: block }
ol li:before { content: counter(item) ". "; counter-increment: item; }
ol.custom{ padding: 0; counter-reset: item; }
ol.custom li.aa:before { content: counter(item) "A. "; counter-reset: subsection; }
@nsa-yoda
nsa-yoda / minMatrixAnim.js
Created March 18, 2013 15:49
An HTML/Javascript implementation of the Matrix falling code in as few bytes as possible.
/*
Original web post: http://timelessname.com/sandbox/matrix_orig.html
Updated web post: http://timelessname.com/sandbox/matrix.html
Reddit post where code is whittled down: http://www.reddit.com/r/programming/comments/1ag0c3/someone_posted_an_htmljavascript_implementation/
*/
<body style=margin:0 onload="for(s=window.screen,w=q.width=s.width,h=q.height=s.height,m=Math.random,p=[],i=0;i<256;p[i++]=1);setInterval('9Style=\'rgba(0,0,0,.05)\'9Rect(0,0,w,h)9Style=\'#0F0\';p.map(function(v,i){9Text(String.fromCharCode(3e4+m()*33),i*10,v);p[i]=v>758+m()*1e4?0:v+10})'.split(9).join(';q.getContext(\'2d\').fill'),33)"><canvas id=q>
@nsa-yoda
nsa-yoda / gist:5207739
Created March 20, 2013 19:34
A dirty javascript function to calculate a new price based on a given price per number of items list.
<script text='text/javascript'>
// function to calculate and update based on price and number of items
function updateInpPrice(val){
if(!val || isNaN(val) || val == 0) val = 1;
val = Math.floor(Math.ceil(val));
var js_prices = [{"bounds":{"lowerBound":51,"upperBound":100},"price":"65.9900"},{"bounds":{"lowerBound":26,"upperBound":50},"price":"69.9900"},{"bounds":{"lowerBound":11,"upperBound":25},"price":"74.9900"},{"bounds":{"lowerBound":1,"upperBound":10},"price":"79.0000"}];
var lenv = js_prices.length - 1;
var iter = 0;
@nsa-yoda
nsa-yoda / gist:5321031
Created April 5, 2013 17:21
Rudimentary Python based MD5 cracker up to a value of 99,999,999 only ints.
# Takes a user input, hashes it with MD5 crypt, and attempts to match it via brute force
import hashlib, time
md = hashlib.md5()
print("Welcome to a brute force MD5 cracker. \n")
password = input("Enter a password, composed of a number up to 99,999,999: ")
md.update(str(password).encode("utf-8"))
hashed_password = md.hexdigest()
@nsa-yoda
nsa-yoda / MD5BruteIntCracker.py
Last active December 16, 2015 21:59
Brute force int MD5 cracker (ints up to 999,999,999) that do NOT start with 0.
import hashlib
def getHexDigest(value):
md5 = hashlib.md5()
md5.update(str(value).encode("utf-8"))
return md5.hexdigest()
def MD5BruteInt(integer):
hexdigest = getHexDigest(integer)
for i in range(999999999):
@nsa-yoda
nsa-yoda / ssh.sh
Last active April 10, 2018 06:38
Small bash script to open multiple terminal windows and auto SSH to several servers
#!/bin/bash
# Dependencies: gnome, sshpass, ssh, gui
gnome-terminal --maximize --tab --title='Hades' --command 'sshpass -p "afsd@#$5u89f" ssh root@192.168.0.125' \
--tab --title='Kronos' --command 'sshpass -p "sad;fi@#$0al" ssh root@192.168.0.126' \
--tab --title='Zeus' --command 'sshpass -p "afsd@#$5u89f" ssh root@192.168.0.127' \
--tab --title='Midas' --command 'sshpass -p "sad;fi@#$0al" ssh root@192.168.0.128' \
--tab --title='Thor' --command 'sshpass -p "afsd@#$5u89f" ssh root@192.168.0.129' \
--tab --title='Herc' --command 'sshpass -p "sad;fi@#$0al" ssh root@192.168.0.130'
@nsa-yoda
nsa-yoda / gist:5543613
Created May 8, 2013 21:00
SHSQL (Shorthand SQL)
{+conf}
def:i>11
def:s>200
set:case>all_lowercase
{-conf}
{+sql}
+table
column:i, column:s
+table
@nsa-yoda
nsa-yoda / doublingTriangle
Last active December 18, 2015 03:18
Dirty recursive doubling triangle in PHP
<?php
echo "<center>";
doublingTriangle(1, 128);
echo "</center>";
function doublingTriangle($currentNumber = 1, $goalNumber = 10){
if($currentNumber <= $goalNumber){
if($currentNumber <= 1){
echo $currentNumber . "<br>";
@nsa-yoda
nsa-yoda / selfReloadingJS
Last active December 18, 2015 12:39
Useful for doing side by side CSS styling without having to reload the page - see results on the fly with a cheap function.
<html>
<head>
<title>Blerg</title>
</head>
<body>
This page reloads every 100ms
<script type="text/javascript">
!(function(){
setTimeout(function(){
@nsa-yoda
nsa-yoda / DirectoryReader.php
Created August 14, 2013 17:57
A class for reading a directory which returns an array with files and directories in two distinct nodes, with each file or directories permissions.
<?php
class DirectoryReader{
private $directory;
private $listing;
public function __construct($directory){
try {
$this->directory = $directory;
$this->listing = array();