Skip to content

Instantly share code, notes, and snippets.

Traian Nedelea tron1point0

Block or report user

Report or block tron1point0

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View volume.sh
#!/usr/bin/env bash
ME=$(basename $0)
MUTEFILE=~/.channels.mute
usage() {
cat <<END
$ME COMMAND [ARGS...]: Volume control / muting
Commands:
View totp.pl
#!/usr/bin/env perl
use v5.16;
use warnings;
use Digest::HMAC_SHA1 qw(hmac_sha1);
use Convert::Base32 qw(decode_base32);
use Getopt::Long;
use Pod::Usage;
View index.html
<!DOCTYPE html>
<html>
<head>
<title>Large Type</title>
<link rel="stylesheet/less" type="text/css" href="style.less">
<script type="text/javascript" src="lib/jquery-2.1.4.min.js"></script>
<script type="text/javascript" src="lib/less.min.js"></script>
</head>
<body>
<div class="out"><span contenteditable autofocus>*hello*</span></div>
@tron1point0
tron1point0 / totp.pl
Last active Apr 18, 2016
TOTP Authenticator
View totp.pl
#!/usr/bin/env perl
use v5.16;
use warnings;
use Digest::HMAC_SHA1 qw(hmac_sha1);
use Convert::Base32 qw(decode_base32);
use Getopt::Long;
use Pod::Usage;
@tron1point0
tron1point0 / parse.pl
Created May 8, 2014
Java tokenizer/lexer/parser
View parse.pl
:- module(parse,[parse/3]).
:- use_module(library(utils)).
parse(Es) --> complation_units(Es).
compilation_units([E|Es]) --> compilation_unit(E), compilation_units(Es).
compilation_units([],A,A).
compilation_unit(unit(Unit)) -->
View Count.java
import java.util.Date;
public class Count {
static int[] _counts = {
0,1,1,2,
1,2,2,3,
1,2,2,3,
2,3,3,1
};
static int[] counts;
View merge.c
#include <stdlib.h>
#include <stdio.h>
void swap(int32_t **a, int32_t **b) {
int32_t *tmp = *a;
*a = *b;
*b = tmp;
}
/* In-place update of subtree at `i` - O(log(n)) */
View Machine.java
import java.util.List;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Formatter;
public class Machine {
private Tape<Integer>[] tapes;
private int[] memory;
private final int scratch; // index of the scratch tape
@tron1point0
tron1point0 / knapsack.hs
Created May 8, 2014
Bounded knapsack problem
View knapsack.hs
import Data.List
type Weight = Int
type Value = Int
type Item = (String,Weight,Value)
type Pack = ([String],Weight,Value)
knapsack :: (Pack -> Bool) -> [Item] -> [Pack]
knapsack f = sortBy (value) . filter (f) . map (foldl (pack) ([],0,0)) . tail . subsequences
where value (_,_,v1) (_,_,v2) = compare v2 v1
@tron1point0
tron1point0 / Makefile
Created Feb 26, 2014
Merge multiple arrays.
View Makefile
merge: merge.c
$(CC) -std=c89 -Wall $^ -o $@
clean:
-rm merge
You can’t perform that action at this time.