Skip to content

Instantly share code, notes, and snippets.

View ss23's full-sized avatar

☃ Stephen Shkardoon ☃ ss23

View GitHub Profile
@ss23
ss23 / gist:774360
Created January 11, 2011 12:44
PHP crypt() example
<?php
$Password = 'SuperSecurePassword123';
// These only work for CRYPT_SHA512, but it should give you an idea of how crypt() works.
$Salt = uniqid(); // Could use the second parameter to give it more entropy.
$Algo = '6'; // This is CRYPT_SHA512 as shown on http://php.net/crypt
$Rounds = '5000'; // The more, the more secure it is!
// This is the "salt" string we give to crypt().
@ss23
ss23 / gist:774376
Created January 11, 2011 12:57
PHP crypt() password checking
<?php
$Password = $_POST['Password'];
$Query = "select `Password` from `Users` where `Username` = '" . mysql_real_escape_string($_POST['Username']) . "'";
$res = mysql_query($Query);
$row = mysql_fetch_assoc($res);
$HashedPassword = $row['Password'];
// Now, what about checking if a password is the right password?
<?php
$Password1 = 'WrongPassword';
$Password2 = 'SuperSecurePassword123';
$sql = "select `Password` from `Users` where id = 5";
$res = mysql_query($sql);
if ($res) {
$foo = mysql_fetch_assoc($res);
$HashedPassword = $foo['Password'];
var con = require('net').Socket();
con.on('connect', connected);
con.setEncoding('utf8');
con.connect(6667, 'irc.ss23.geek.nz');
function connected() {
// Connected!
// As soon as we receive some data, we can write our NICK / USER
ss23@Crisp ~/irc_node $ node irc.js
[2011-5-14 2:15:52]-> NICK ss23bot
[2011-5-14 2:15:52]-> USER ss23 ss23`bot ss23`bot :ss23`bot
14 Jun 02:15:52 - Adding
[2011-5-14 2:15:52]<- :irc.ss23.geek.nz NOTICE AUTH :*** Looking up your hostname...
14 Jun 02:15:52 - Adding
[2011-5-14 2:15:52]<- :irc.ss23.geek.nz NOTICE AUTH :*** Found your hostname (cached)
14 Jun 02:15:52 - Adding
[2011-5-14 2:15:52]<- :irc.ss23.geek.nz NOTICE AUTH :*** Checking ident...
@ss23
ss23 / gist:1252520
Created September 30, 2011 02:44
My Crons
# Min Hour DOM Month DOW Command
1 3 * * * updatedb >/dev/null 2>&1
1 13 * * * emerge --sync >/var/log/emerge-cron.log 2>&1
* * * * * /usr/bin/mrtg /etc/mrtg.conf >/dev/null 2>&1
@ss23
ss23 / gist:1289596
Created October 15, 2011 13:54
Launchpad Fail
//***********************************************************
// Lab5.c Temperature sampling example using ADC10
// Clocking: MCLK and SMCLK = 1.1MHz DCO/8
// ACLK = 12kHz VLO
//
// SFB 9/2010
//***********************************************************
#include <msp430g2231.h>
@ss23
ss23 / gist:1307236
Created October 23, 2011 10:48
Failed kernel compilation
(chroot) Crisp linux # make -j5
CHK include/linux/version.h
CHK include/generated/utsrelease.h
CALL scripts/checksyscalls.sh
CHK include/generated/compile.h
LD grsecurity/built-in.o
grsecurity/grsec_disabled.o: In function `gr_is_capable':
grsec_disabled.c:(.text+0x160): multiple definition of `gr_is_capable'
grsecurity/grsec_exec.o:grsec_exec.c:(.text+0x10): first defined here
grsecurity/grsec_disabled.o: In function `gr_is_capable_nolog':
Crisp ss23 # hdparm -r /dev/sdf2
/dev/sdf2:
readonly = 0 (off)
Crisp ss23 # btrfsck /dev/sdf2
found 2394718208 bytes used err is 0
total csum bytes: 1930568
total tree bytes: 417816576
total fs tree bytes: 398311424
btree space waste bytes: 113042195
@ss23
ss23 / gist:1341738
Created November 5, 2011 16:28
Complete build log
>>> Emerging (1 of 3) dev-python/lxml-2.3
* lxml-2.3.tgz RMD160 SHA1 SHA256 size ;-) ... [ ok ]
>>> Unpacking source...
>>> Unpacking lxml-2.3.tgz to /var/tmp/portage/dev-python/lxml-2.3/work
>>> Source unpacked in /var/tmp/portage/dev-python/lxml-2.3/work
>>> Preparing source in /var/tmp/portage/dev-python/lxml-2.3/work/lxml-2.3 ...
>>> Source prepared.
>>> Configuring source in /var/tmp/portage/dev-python/lxml-2.3/work/lxml-2.3 ...
>>> Source configured.
>>> Compiling source in /var/tmp/portage/dev-python/lxml-2.3/work/lxml-2.3 ...