Skip to content

Instantly share code, notes, and snippets.

@peanutwolf
peanutwolf / lockOrient.java
Created October 6, 2015 08:08
Locking orientation on Android
private void lockOrientation(){
int orientation;
int rotation = ((WindowManager) getActivity().getSystemService(
Context.WINDOW_SERVICE)).getDefaultDisplay().getRotation();
switch (rotation) {
case Surface.ROTATION_0:
orientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
break;
case Surface.ROTATION_90:
orientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
@peanutwolf
peanutwolf / dijkstra.py
Created January 30, 2016 11:38 — forked from mdsrosa/dijkstra.py
Modified Python implementation of Dijkstra's Algorithm (https://gist.github.com/econchick/4666413)
from collections import defaultdict, deque
class Graph(object):
def __init__(self):
self.nodes = set()
self.edges = defaultdict(list)
self.distances = {}
def add_node(self, value):
#!/usr/bin/python3
__author__ = 'vigurskiy'
import sys
import difflib
import re
import os
version_template_arcus = '\A\d+\.\d+\.\d+\.\d+ \[\d{1,2}\.\d{1,2}\.\d{2,4}\]\s{1}'
version_template = '\A\d+\.\d+\.\d+\.\d+ \[\d{1,4}\.\d{1,2}\.\d{1,2}\]\s{1}'
#include <memory>
#include <cstdlib>
#include <restbed>
using namespace std;
using namespace restbed;
class CustomLogger : public Logger
{
@peanutwolf
peanutwolf / proxybin.go
Created March 11, 2020 07:32
Simple executable args sniffer written in golang
package main
import (
"log"
"os"
"os/exec"
"path/filepath"
"strings"
ps "github.com/mitchellh/go-ps"
/* GStreamer
* Copyright (C) 2008 Wim Taymans <wim.taymans at gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of