Skip to content

Instantly share code, notes, and snippets.

View cxdy's full-sized avatar
🤠
Yee haw

Cody Kaczynski cxdy

🤠
Yee haw
View GitHub Profile
@cxdy
cxdy / login function.php
Last active August 29, 2015 14:05
My login function
<?php
function login($email, $password, $mysqli) {
// Prepared Statements make me happy :)
if ($stmt = $mysqli->prepare("SELECT id, username, password, salt
FROM members
WHERE email = ?
LIMIT 1")) {
$stmt->bind_param('s', $email);
$stmt->execute();
$stmt->store_result();
@cxdy
cxdy / idk.php
Created September 14, 2014 01:58
md5 IP example
<?php
$note_name = 'note.txt';
$uniqueNotePerIP = true;
if($uniqueNotePerIP){
$note_name = 'notes/'.md5($_SERVER['REMOTE_ADDR']).'.txt';
}
if(isset($_SERVER['HTTP_X_REQUESTED_WITH'])){
@cxdy
cxdy / httpserver.js
Created September 30, 2014 21:08
An example of an HTTP server
// Load the http module to create an http server.
var http = require('http');
// Configure our HTTP server to respond with Hello World to all requests.
var server = http.createServer(function (request, response) {
response.writeHead(200, {"Content-Type": "text/plain"});
response.end("Hello World\n");
});
// Listen on port 8000, IP defaults to 127.0.0.1
@cxdy
cxdy / Form1.cs
Created October 2, 2014 13:39
C# Simple Calculator
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace SimpleCalculator
@cxdy
cxdy / example.html
Created October 5, 2014 00:07
Using Scrobbl.in
<div class="lastfm"></div>
<script>
var scrobblinRefreshTimer = 10;
var scrobblinFileLocation = 'scrobblin.php';
$(document).ready(function() {
refreshScrobblin();
setInterval(function() { refreshScrobblin() }, scrobblinRefreshTimer * 1000);
@cxdy
cxdy / sqli.py
Created November 26, 2014 02:59
Easy SQLi Finder
import requests, sys
# This program shows the simplicity
# of requests, Best library ever.
sqlcheck = ["SQL error:", "Warning:", "supplied argument", "PHP Warning:"]
if len(sys.argv) == 1:
print "usage: sqli.py http://hostname.com/"
exit(0)

Keybase proof

I hereby claim:

  • I am cxdy on github.
  • I am cxdy (https://keybase.io/cxdy) on keybase.
  • I have a public key whose fingerprint is B4EC 2AE4 9B6A 82CC CC90 018C 8C03 06AE 682E 59A7

To claim this, I am signing this object:

@cxdy
cxdy / lastfm.php
Created December 15, 2017 12:36
last fm current song
<?php
/**
* Package: Scrobbl.in Core (http://github.com/cxdy/Scrobbl.in)
* Version: 2.0
* Authors: Cody Kaczynski (http://github.com/cxdy)
* License: MIT License (http://opensource.org/licenses/MIT)
* You can obtain a Last.FM API key at http://www.last.fm/api/account/create
* Read the documentation (https://github.com/cxdy/Scrobbl.in/blob/master/README.md)
**/
@cxdy
cxdy / fracs.js
Created July 6, 2019 13:52
Decimal -> Simplified Fraction in Javascript
// This was made to convert shutter speeds from node-exif from decimals of a second to fractions of a second.
// Example: 0.00125 converts to 1/800
var input = "0.00125";
function doMath(result, string) {
console.log(`${string} is ${result[0]}/${result[1]}th of a second`);
return result;
}
@cxdy
cxdy / exif.js
Created July 6, 2019 14:55
callback mania
var ExifImage = require('exif').ExifImage;
var image = 'DSC_8041.jpg';
// Step 5, send data off
function finish(EXIF) {
console.log(`Finished EXIF: ` + JSON.stringify(EXIF));
return EXIF;
}
// Step 4, reformat data