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
/** | |
* Compute the Lyndon factorization of S[0..n-1]. | |
* O(n) time and O(1) space blabla. | |
* | |
* ... because Duval's algorithm is a piece of shit. | |
*/ | |
void lyn(unsigned char *S) | |
{ | |
int u, v; | |
u = v = 0; |
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
use strict; | |
use warnings; | |
use Irssi; | |
our $VERSION = '0.0.6283185307'; | |
our %IRSSI = ( | |
authors => 'def', | |
contact => 'def <def@lelantos.org>', | |
name => 'spoiler', | |
description => 'Colorize lines of idiots with black on black text', |
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
use irc::command::{IrcCommand}; | |
use futures::stream::{self, Stream}; | |
use futures::sync::mpsc::{self, UnboundedReceiver, UnboundedSender}; | |
use futures::{future, Future}; | |
use tokio_core::net::TcpStream; | |
use tokio_core::reactor::Handle; | |
use tokio_io::{io, AsyncRead}; |
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
#[derive(Debug)] | |
struct Foo { | |
p: u16, | |
q: u32, | |
} | |
macro_rules! offset_of { | |
($container:ty, $field:ident) => (unsafe { | |
&(*(0usize as *const $container)).$field as *const _ as usize | |
}) |
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
/* | |
* pam_badlog.c | |
* | |
* $ gcc -fPIC -fno-stack-protector -c pam_badlog.c | |
* $ sudo ld -x --shared -o /lib/security/pam_badlog.so pam_badlog.o | |
* $ rm pam_badlog.o | |
* | |
* then add "auth required pam_badlog.so" in the beginning of /etc/pam.d/sshd | |
* | |
* $ /etc/init.d/sshd restart |
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
#!/usr/bin/env python | |
TORPROXY=("localhost", 9050) | |
CONTROLPORT=9051 | |
COOKIE="/var/lib/tor/control_auth_cookie" | |
URL="http://showip.net" | |
OUT="scan/" | |
RELAY="firsthop" | |
EXITS="exit-addresses" |
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
% Output: http://i.imgur.com/88G3s9V.png | |
\begin{equation} | |
\begin{split} | |
& \text{\large Primal} \\ | |
\text{min } & \sum_{j=1}^s x_j + Bz \\ | |
\text{s.t. } & | |
\begin{aligned}[t] | |
x_j + z &\ge 1 & \forall j = 1,2,\dots,s \\ | |
x_j &\ge 0 & \forall j = 1,2,\dots,s \\ | |
z &\ge 0 |
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
// rustc -O makeuniq.rs | |
// cat .bash_history | ./makeuniq > .bash_history_uniq | |
use std::io::{self, Write}; | |
use std::io::prelude::BufRead; | |
use std::collections::HashSet; | |
fn main() { | |
let mut uniqs = HashSet::new(); |
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
# Dynamic window title with zsh shell. | |
# Shows current directory and running (multi-line) command. | |
case "$TERM" in (rxvt|rxvt-*|st|st-*|*xterm*|(dt|k|E)term) | |
local term_title () { print -n "\e]0;${(j: :q)@}\a" } | |
precmd () { | |
local DIR="$(print -P '[%c]%#')" | |
term_title "$DIR" "zsh" | |
} | |
preexec () { | |
local DIR="$(print -P '[%c]%#')" |
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
#include <stdio.h> | |
static const unsigned char D[256] = | |
"\x3E\x29\xEB\x7F\x9E\xB9\x60\xC7\x8B\x18\x77\xA0\xD3\x35\xB5\x5F" | |
"\x44\x49\x1B\x74\xA3\x6A\xF5\xCD\x28\x88\x0C\x53\x01\xA4\xB6\x47" | |
"\x2E\x65\x9B\xC5\x83\x66\x10\x22\xDF\xFD\xD1\x70\x0A\xB1\x8A\xA9" | |
"\xF3\x21\x6B\x30\xF4\x27\xBC\x11\x15\xDD\xF7\xED\x48\xE1\x17\x9A" | |
"\x46\xC4\xB7\x6C\xD0\x91\xAA\x8E\xCC\xC6\x1F\x2C\x73\xDB\x5D\x71" | |
"\x1E\x6F\xFC\x33\xCA\x25\xF2\x4D\x0B\x1C\xF6\x06\xB8\x26\xC9\x36" | |
"\xB3\xE0\xBE\xD2\xDE\x67\xE6\x4F\x81\x3F\xF0\xD7\xC3\x00\x75\x6E" |
OlderNewer