Skip to content

Instantly share code, notes, and snippets.

View chrisdiana's full-sized avatar

Chris Diana chrisdiana

View GitHub Profile
@chrisdiana
chrisdiana / gist:ac64daf20d405b33d7a6
Last active September 10, 2021 12:24
PHP Login without Database
<?php
session_start();
// ***************************************** //
// ********** DECLARE VARIABLES ********** //
// ***************************************** //
$username = 'username';
$password = 'password';
@chrisdiana
chrisdiana / footer.js
Last active January 28, 2021 03:42
Dynamically add footer to jQuery Datatable
@chrisdiana
chrisdiana / size.py
Created May 23, 2016 00:05
Check file size in Python
SUFFIXES = {1000: ['KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'],
1024: ['KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB']}
def approximate_size(size, a_kilobyte_is_1024_bytes=True):
'''Convert a file size to human-readable form.
Keyword arguments:
size -- file size in bytes
a_kilobyte_is_1024_bytes -- if True (default), use multiples of 1024
if False, use multiples of 1000
@chrisdiana
chrisdiana / cars.json
Created July 28, 2015 05:43
JSON Array of all cars makes and models (71 makes and over 1,300 different models)
[{"value":"ACURA","title":"Acura","models":[{"value":"CL_MODELS","title":"CL Models (4)"},{"value":"2.2CL","title":" - 2.2CL"},{"value":"2.3CL","title":" - 2.3CL"},{"value":"3.0CL","title":" - 3.0CL"},{"value":"3.2CL","title":" - 3.2CL"},{"value":"ILX","title":"ILX"},{"value":"INTEG","title":"Integra"},{"value":"LEGEND","title":"Legend"},{"value":"MDX","title":"MDX"},{"value":"NSX","title":"NSX"},{"value":"RDX","title":"RDX"},{"value":"RL_MODELS","title":"RL Models (2)"},{"value":"3.5RL","title":" - 3.5 RL"},{"value":"RL","title":" - RL"},{"value":"RSX","title":"RSX"},{"value":"SLX","title":"SLX"},{"value":"TL_MODELS","title":"TL Models (3)"},{"value":"2.5TL","title":" - 2.5TL"},{"value":"3.2TL","title":" - 3.2TL"},{"value":"TL","title":" - TL"},{"value":"TSX","title":"TSX"},{"value":"VIGOR","title":"Vigor"},{"value":"ZDX","title":"ZDX"},{"value":"ACUOTH","title":"Other Acura Models"}]},{"value":"ALFA","title":"Alfa Romeo","models":[{"value":"ALFA164","title":"164"},{"value":"ALFA8C","title":"8C Competizione"
@chrisdiana
chrisdiana / kali-usb.md
Last active March 15, 2019 15:25
Kali with USB Persistence

Kali USB Persistence

  1. Partition USB to 3 sections (KaliLinux, Persistence, USBStorage)

  2. Run Mac Linux USB Loader for KaliLinux partition and install with iso

  3. In KaliLinux partition, set 'efi/boot/enterprise.cfg' to this:

entry Kali
@chrisdiana
chrisdiana / reset.css
Created June 2, 2017 17:03
Tiny CSS Resets
/************* Method #1 ***************/
html, body, h1, h2, h3, h4, h5, h6, p, ol, ul, li, dl, dt, dd, blockquote, address {
margin: 0;
padding: 0;
}
/************* Method #2 ***************/
html, body, div, span, applet, object, iframe,
@chrisdiana
chrisdiana / gist:04431f0c8cf75a1e90a7
Created September 9, 2014 17:32
Add Done and Dismiss Keyboard for UITextView in Xamarin
// sample text box
var deedDescriptionField = new UITextView (new RectangleF (0, 230, UIScreen.MainScreen.Bounds.Width, 100)){
BackgroundColor = UIColor.White,
Text = " Description:",
TextColor = ViewHelpers.DarkGray,
Font = UIFont.FromName("Helvetica", 18f)
};
// change the return key to done
descriptionField.ReturnKeyType = UIReturnKeyType.Done;
// dismiss keyboard on done
@chrisdiana
chrisdiana / funterm.txt
Created August 11, 2015 18:19
Fun with Terminal
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
██ ██
█▌ - FUN ON THE TERMINAL - █▌
█▌ PUBLIC TELNET ASCII ART, GAMES, ETC (ALL OSes) █▌
█ ▐▌
█ ▐▌
█ Connect to other servers through telnet to view their animated ASCII art, ▐▌
█ games, etc they offer the public. If no port is specified than it is the ▐▌
█ default port 23; you don't need to specify it. ▐▌
█ ▐▌
@chrisdiana
chrisdiana / gist:f0777eb35a5adece8422
Last active November 2, 2017 16:20
Reset GIT to commit force push
# Local reset:
git reset --hard fj5789sufj
# Remote reset:
git push -f origin fj5789sufj:master
@chrisdiana
chrisdiana / jquertips.md
Created October 22, 2015 16:45
jQuery Tips