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
<?php | |
# Copyright Alexandre Syenchuk, 2012 | |
# a multi-site, multi-duplicates version of https://gist.github.com/1177018 | |
header('Content-type: text/plain; charset=utf-8'); | |
include('wp-config.php'); | |
include('wp-load.php'); | |
global $wpdb; |
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
// converts 32-bits positive integer to 4-bytes little endian | |
void to4li(unsigned long int const value, char * const buffer) | |
{ | |
buffer[0] = value >> 8 * 0; | |
buffer[1] = value >> 8 * 1; | |
buffer[2] = value >> 8 * 2; | |
buffer[3] = value >> 8 * 3; | |
} | |
// converts 16-bits positive integer to 2-bytes little endian |
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
void * safe_malloc(size_t const size) | |
{ | |
void * p = malloc(size); | |
if (p == NULL) { | |
fprintf(stderr, "Out of memory\n"); | |
exit(1); | |
} | |
return p; |
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
<input type="text" class="input-float" pattern="\d+((,|\.)\d\d?)*" /> |
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
tac somefile | sponge somefile |
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
# 1 min 20 s (including login and tests) | |
for k in range(1, 101): | |
if not k % 3 and not k % 5: | |
print "FizzBuzz" | |
elif not k % 3: | |
print "Fizz" | |
elif not k % 5: | |
print "Buzz" | |
else: | |
print k |
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
# coding: utf-8 | |
import re | |
import subprocess | |
import time | |
LOG_FILE = '/var/log/temperature.csv' | |
res = subprocess.check_output(['sensors']) | |
res = re.findall(r':\s+\+(\d\d\.\d)°C', res) |
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
The MIT License (MIT) | |
Copyright (c) 2013 Alexandre Syenchuk | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is | |
furnished to do so, subject to the following conditions: |
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
// -*- coding: utf-8; tab-width: 2; indent-tabs-mode: nil; -*- | |
// | |
// Generates Wi-Fi passwords generated in the web interface of the “La box de | |
// SFR” home router. | |
// | |
// In many browsers, this implementation is broken because of a very short | |
// period of the pseudo-random Math.random() funciton, usually around 2^30. | |
// | |
// You can generate a passwords file of several gigabytes and run a | |
// successfull bruteforce attack in a couple of hours against A WPA key. |
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
modes = { | |
'A': ( | |
' ', '!', '"', '#', '$', '%', '&', "'", '(', ')', '*', '+', ',', '-', | |
'.', '/', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', | |
'<', '=', '>', '?', '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', | |
'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', | |
'X', 'Y', 'Z', '[', '\\', ']', '^', '_', '\x00', '\x01', '\x02', | |
'\x03', '\x04', '\x05', '\x06', '\x07', '\x08', '\x09', '\x0A', '\x0B', | |
'\x0C', '\x0D', '\x0E', '\x0F', '\x10', '\x11', '\x12', '\x13', '\x14', | |
'\x15', '\x16', '\x17', '\x18', '\x19', '\x1A', '\x1B', '\x1C', '\x1D', |
OlderNewer