Skip to content

Instantly share code, notes, and snippets.

@tatewake
tatewake / obfuscate2.java
Last active September 21, 2017 00:26
Implementation of state machine described by the "deobfuscate" code example in http://antonioparata.blogspot.it/2017/09/using-mealy-automata-for-string.html
public class obfuscate2
{
enum StateType
{
kUninitialized,
kDestroyed,
k0,
k1,
k10,
k11,
@tatewake
tatewake / obfuscate.java
Last active September 21, 2017 00:26
Implementation of state machine described by graphic in http://antonioparata.blogspot.it/2017/09/using-mealy-automata-for-string.html
import java.lang.*;
public class obfuscate
{
enum StateType
{
kUninitialized,
kDestroyed,
k0,
k1,
@tatewake
tatewake / tGraphOps.cc
Created June 21, 2017 23:54
tGraph: introspection of edges based on a single vertex
//-- Helper method
template<typename V, typename E>
template<typename T> bool tGraph<V, E>::Equal(T a, T b)
{
return !(a < b) && !(b < a);
}
//-- Introspection of edges based on a single vertex
template<typename V, typename E> typename tGraph<V, E>::EdgeSet tGraph<V, E>::outgoingEdgesOf(const VertexType& v) const
{
public class fizzbuzz
{
enum StateType
{
kUninitialized,
kDestroyed,
kIdle,
kStart,
};
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<graphml xmlns="http://graphml.graphdrawing.org/xmlns" xmlns:java="http://www.yworks.com/xml/yfiles-common/1.0/java" xmlns:sys="http://www.yworks.com/xml/yfiles-common/markup/primitives/2.0" xmlns:x="http://www.yworks.com/xml/yfiles-common/markup/2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:y="http://www.yworks.com/xml/graphml" xmlns:yed="http://www.yworks.com/xml/yed/3" xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns http://www.yworks.com/xml/schema/graphml/1.1/ygraphml.xsd">
<!--Created by yEd 3.16.2.1-->
<key attr.name="Description" attr.type="string" for="graph" id="d0"/>
<key for="port" id="d1" yfiles.type="portgraphics"/>
<key for="port" id="d2" yfiles.type="portgeometry"/>
<key for="port" id="d3" yfiles.type="portuserdata"/>
<key attr.name="url" attr.type="string" for="node" id="d4"/>
<key attr.name="description" attr.type="string" for="node" id="d5"/>
<key for="node" id="d6" yfiles.type="nodegraphics"/
public class TicTacToe
{
protected enum StateType
{
kUninitialized,
kDestroyed,
kEnd,
kOsTurn,
kXsTurn,
};
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<graphml xmlns="http://graphml.graphdrawing.org/xmlns" xmlns:java="http://www.yworks.com/xml/yfiles-common/1.0/java" xmlns:sys="http://www.yworks.com/xml/yfiles-common/markup/primitives/2.0" xmlns:x="http://www.yworks.com/xml/yfiles-common/markup/2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:y="http://www.yworks.com/xml/graphml" xmlns:yed="http://www.yworks.com/xml/yed/3" xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns http://www.yworks.com/xml/schema/graphml/1.1/ygraphml.xsd">
<!--Created by yEd 3.16.2.1-->
<key attr.name="Description" attr.type="string" for="graph" id="d0"/>
<key for="port" id="d1" yfiles.type="portgraphics"/>
<key for="port" id="d2" yfiles.type="portgeometry"/>
<key for="port" id="d3" yfiles.type="portuserdata"/>
<key attr.name="url" attr.type="string" for="node" id="d4"/>
<key attr.name="description" attr.type="string" for="node" id="d5"/>
<key for="node" id="d6" yfiles.type="nodegraphics"/
@tatewake
tatewake / verifier.c
Last active January 26, 2017 00:27
Rewrite of bpf_analyzer from http://lxr.free-electrons.com/source/kernel/bpf/verifier.c#L3198 without gotos
/* Original: */
int bpf_analyzer(struct bpf_prog *prog, const struct bpf_ext_analyzer_ops *ops,
void *priv)
{
struct bpf_verifier_env *env;
int ret;
env = kzalloc(sizeof(struct bpf_verifier_env), GFP_KERNEL);
if (!env)
@tatewake
tatewake / gist:5449674
Created April 24, 2013 04:42
GYP configurations example
{
'target_defaults': {
'configurations': {
'debug': {
'defines': [ 'GAMMA', ], #defines
}, # debug
}, # configurations
},
'targets': [