This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def generate_duplicate_name(f_name,output_path): | |
## snipet that allows duplicate file generation if need be | |
# by: Cody Kochmann | |
from os import listdir | |
if f_name in listdir(output_path): | |
if allow_duplicates == False: | |
v_print(f_name+" already downloaded") | |
return(False) | |
else: | |
placeholder_name=2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var pct_of_smaller_side = function(dom_e,selected_percent){ | |
// sizes a dom element to the smaller sized side | |
var width = $(window).width(); | |
var height = $(window).height(); | |
var important_measurement=0; | |
if (width>height){ | |
important_measurement=height*selected_percent; | |
} else { | |
important_measurement=width*selected_percent; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var set_view = function(dom_e){ | |
// sets horizontal or vertical view rules of a dom element | |
// by: Cody Kochmann | |
var width = $(window).width(); | |
var height = $(window).height(); | |
var horizontal=width>height; | |
var vertical=!horizontal; | |
if (horizontal){ | |
if(dom_e.hasClass('horizontal')==false){ | |
dom_e.addClass('horizontal'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.timed_interval = (@main_process, @timeout, @verbose=true) -> | |
`/* | |
Author: Cody Kochmann | |
Build: 4 | |
Date Last Modified: Fri Jun 12 09:53:37 PDT 2015 | |
This is an improved function to the currently used setInterval in javascript. | |
It has better Controls towards the control flow of the interval overall. | |
This implementation also prevents function overlapping where is the interval | |
is set too quickly and tries to run again before the previous |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(){ | |
/* CryptoJS v3.1.2 below */ | |
var CryptoJS=CryptoJS||function(g,p){var e={},m=e.lib={},r=function(){},v=m.Base={extend:function(a){r.prototype=this;var d=new r;a&&d.mixIn(a);d.hasOwnProperty("init")||(d.init=function(){d.$super.init.apply(this,arguments)});d.init.prototype=d;d.$super=this;return d},create:function(){var a=this.extend();a.init.apply(a,arguments);return a},init:function(){},mixIn:function(a){for(var d in a)a.hasOwnProperty(d)&&(this[d]=a[d]);a.hasOwnProperty("toString")&&(this.toString=a.toString)},clone:function(){return this.init.prototype.extend(this)}}, | |
u=m.WordArray=v.extend({init:function(a,d){a=this.words=a||[];this.sigBytes=d!=p?d:4*a.length},toString:function(a){return(a||x).stringify(this)},concat:function(a){var d=this.words,l=a.words,b=this.sigBytes;a=a.sigBytes;this.clamp();if(b%4)for(var q=0;q<a;q++)d[b+q>>>2]|=(l[q>>>2]>>>24-q%4*8&255)<<24-(b+q)%4*8;else if(65535<l.length)for(q=0;q<a;q+=4)d[b+q>>>2]=l[q>>>2];else d.push.apply(d,l);this.sigBytes+=a;return this},clamp:fu |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# easy sha256 bit encrytion archive for securing important files | |
7z a -mhe=on -p <archive-name>.7z <important-file-1> <important-file-2> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo "enter the key name." \ | |
&& read keyname \ | |
&& cd ~/.ssh \ | |
&& ssh-keygen -b 4096 -t rsa -f $keyname |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for i in outgoing incoming | |
do | |
ufw default deny $i | |
done | |
for i in ssh http https "out http" "out https" 1194/udp 53 | |
do | |
ufw allow $i | |
done | |
&& ufw enable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ # try | |
} || { # catch | |
# print the error here | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fallocate -l 4G /swapfile \ | |
&& chmod 600 /swapfile \ | |
&& mkswap /swapfile \ | |
&& swapon /swapfile \ | |
&& echo "/swapfile none swap sw 0 0" >> /etc/fstab |