Skip to content

Instantly share code, notes, and snippets.

@illucent
illucent / dice.py
Created November 15, 2015 12:19 — forked from jclement/dice.py
Quick little program to generate passphrases from the diceware word list. (I do realize using the computer RNG to generate the list negates part of the point of *dice*ware)
#!/usr/bin/env python
# DICEWARE WORD LIST FROM:
# http://world.std.com/~reinhold/diceware.html
lines = """11111 a
11112 a&p
11113 a's
11114 aa
11115 aaa
@illucent
illucent / numpy-04_fft.py
Created November 15, 2015 12:10 — forked from dlouapre/numpy-04_fft.py
Numpy FFT
# -*- coding: utf-8 -*-
from numpy import *
from numpy.random import *
from numpy.fft import *
from pylab import *
N = 2**9 # FFT works better with signals whose length is power of 2
T = 10 # Length of time interval
t = linspace(0,T,N)
@illucent
illucent / np_normal_vector.py
Created November 15, 2015 11:23 — forked from nortikin/np_normal_vector.py
normalvector_numpy
import bpy
import numpy as np
name = bpy.context.selected_objects[0].name
mon = np.array([i.co[:] for i in bpy.data.objects[name].data.vertices])
nor = np.linalg.norm(mon,axis=1)
out = mon/nor.reshape(len(nor),1)
for i,k in enumerate(bpy.data.objects[name].data.vertices):
k.co[:] = out[i]
@illucent
illucent / 10.2.py
Created November 13, 2015 13:51 — forked from KKarthikeya/10.2.py
Write a program to read through the mbox-short.txt and figure out the distribution by hour of the day for each of the messages. You can pull the hour out from the 'From ' line by finding the time and then splitting the string a second time using a colon. From stephen.marquard@uct.ac.za Sat Jan 5 09:14:16 2008 Once you have accumulated the counts…
mails = dict()
for line in open( raw_input("Enter File Name:")):
words = line.strip().split()
if len(words) == 0 and len(words)<2:
continue
if words[0] == 'From':
hours = words[5].split(':')
if hours[0] not in mails:
mails[hours[0]] = 1
else:
@illucent
illucent / hardware-info.sh
Created November 10, 2015 11:21 — forked from lainfinity/hardware-info.sh
hardware info
#!/bin/bash
########################################################################
#### Script Name: inxi
#### version: 1.8.11
#### Date: June 26 2012
#### Patch Number: 00
########################################################################
#### SPECIAL THANKS
########################################################################
#### Special thanks to all those in #lsc and #smxi for their tireless
@illucent
illucent / another_plugin.php
Created November 9, 2015 20:20 — forked from jackreichert/another_plugin.php
wp-jsonp example
<?php
/**
* Plugin Name: another plugin
* Plugin URI: http://www.jackreichert.com/2015/07/02/how-to-jsonp-ajax-to-ssl-in-wordpress-an-easier-way/
* Description: An example of how you might use wp_jsonp.
* Version: 0.1
* Author: jackreichert
* Author URI: http://www.jackreichert.com/
* License: GPL3
@illucent
illucent / jsonp.js
Created November 9, 2015 20:12 — forked from jackreichert/jsonp.js
wp_jsonp
if (typeof wp_jsonp === 'undefined')
var wp_jsonp = function (event, method, params, callbackFunc) {
// data needed to send jsonp
var data = {
action: event, // wp ajax action
ajaxSSLNonce: wp_jsonp_vars.wpAJAXNonce, // nonce
method: method, // server has switch/case for processing
params: params // data to be processed
};
@illucent
illucent / login.js
Created November 9, 2015 19:12 — forked from tannerm/login.js
WordPress Ajax Login
jQuery(document).ready(function($){
'use strict';
var ajaxLogin = function() {
var SELF = this;
SELF.data = {'security': tm.security};
SELF.init = function(id) {
SELF.$loginContainer = $(id);
@illucent
illucent / functions.php
Created November 9, 2015 17:47 — forked from timersys/functions.php
Wordpress Front end registration
/***************************
INSIDE FUNCTIONS.PHP
****************************/
/**
* Formulario de registro
*/
//change register url for our custom one
add_filter('register_url', function(){ return site_url('registrese');});
@illucent
illucent / gist:c00ea8fce7c79138d8be
Created November 9, 2015 17:40 — forked from ivandoric/gist:e4e46294c4d35eac0ec8
wordpress: create custom reset password page
<?php //Add all of this tu custom page template ?>
<?php
global $wpdb;
$error = '';
$success = '';
// check if we're in reset form
if( isset( $_POST['action'] ) && 'reset' == $_POST['action'] )
{