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
Vk[p_List] := | |
Module[{r = | |
DeleteCases[ | |
MapIndexed[If[#1[[1]] < #1[[2]], Length[p] - First[#2]] &, | |
Reverse@Partition[p, 2, 1]], Null]}, | |
If[Length[r] > 0, First[r], Null]] | |
Vl[p_List, k_Integer] := | |
Module[{r = | |
DeleteCases[ |
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
#!/bin/bash | |
if [ $# -gt 0 ]; then | |
basepath="$1" | |
else | |
basepath= | |
fi | |
for i in "${basepath}"*.mkv; do | |
e=$(echo "${basepath}"$i | sed -e 's/.*[Ss][0-9]\+[Ee]\([0-9]\+\).*/\1/') |
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
def merge(a, b): | |
if not a: | |
return b | |
if not b: | |
return a | |
return a[:1] + merge(a[1:], b) if a[0] < b[0] else b[:1] + merge(a, b[1:]) | |
def mergesort(a): | |
len_a = len(a) | |
if len_a == 1: |
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 <ffi.h> | |
#include <iostream> | |
using namespace std; | |
class IInterface { | |
public: | |
virtual void fn1(int a, int b) = 0; | |
virtual void fn2(int a, int b) = 0; | |
~IInterface() {} |
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> | |
#include <string.h> | |
#include <stdlib.h> | |
#define MAX_LEN 3000 | |
#define AUX_LEN (MAX_LEN * 2 + 1) | |
int fn[AUX_LEN]; | |
char aux[AUX_LEN+1]; | |
int p[AUX_LEN]; |
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 <string> | |
#include <vector> | |
#include <algorithm> | |
#include <iostream> | |
#include <iterator> | |
#include <unordered_map> | |
using namespace std; | |
namespace { |
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
from usb.core import find | |
from usb.backend import openusb | |
import sys | |
if len(sys.argv) < 2: | |
print ('Usage: python test-openusb.py idvendor:idproduct (in hex)') | |
exit(1) | |
vendor, product = list(map(lambda x: int(x, 16), sys.argv[1].split(':'))) |
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 <usb.h> | |
#include <stdio.h> | |
int main(int argc, char **argv) | |
{ | |
struct usb_bus *bus; | |
struct usb_device *dev = NULL; | |
usb_dev_handle *handle; | |
char dummy_data[5]; | |
int ret; |
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
BEGIN { | |
CRASHSYMBOLS = "~/work/B2G/objdir-debug/dist/crashreporter-symbols/" | |
} | |
{ | |
if (system("test -d "CRASHSYMBOLS $2) == 0) { | |
if (system("test -d "CRASHSYMBOLS $2"/"$1) == 0) { | |
print $2" ok" | |
} else { | |
"ls " CRASHSYMBOLS $2"/" | getline id | |
print "The ids for "$2" don't match: "$1 " "id |
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/python | |
import operator | |
def parent(i): | |
return i/2 | |
def left(i): | |
return i*2 + 1 |
OlderNewer