Skip to content

Instantly share code, notes, and snippets.

View gradha's full-sized avatar

Grzegorz Adam Hankiewicz gradha

View GitHub Profile
@gradha
gradha / ExtractMpegFramesTest_egl14.java
Last active January 16, 2022 14:11
Original source for the ExtractMpegFramesTest_egl14.java file by BigFlake (http://bigflake.com/mediacodec/) and required transformation to handle rotated videos. See http://stackoverflow.com/questions/38699825/why-does-extractmpegframestest-not-work-with-rotated-input-files for more information.
/*
* Copyright 2013 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@gradha
gradha / tumblr-gdpr-cgi-bin-proxy.py
Created August 5, 2018 11:30
Simple python cgi-bin proxy to fetch rss feeds from Europe (see https://github.com/ViennaRSS/vienna-rss/issues/1166)
#!/usr/bin/env python
print "Content-Type: text/xml"
print
# To use this script, put it on your host supporting python 2.x, in the cgi-bin
# directory. Then test with your browser something like
# https://your.host.com/cgi-bin/tumblr-gdpr-cgi-bin-proxy?u=hematocritico.tumblr.com/rss
# Hopefully that works and you get some rss xml.
import cgi
@gradha
gradha / folder265.xml
Created July 31, 2018 21:26
viennarss tumblr fetch without cookies
<!DOCTYPE html>
<!--
.o .o88 .o88
.88 "888 "888
o8888oo ooo oooo ooo. .oo. .oo. 888oooo. 888 oooo d8b
""888"" 888 "888 "888P"Y88bP"Y88b d88' `88b 888 "888""8P
888 888 888 888 888 888 888 888 888 888
888 . 888 888 888 888 888 888. 888 888 888 .o.
"888Y `V88V"V8P' o888o o888o o888o 88`bod8P' o888o d888b Y8P
#!/bin/sh
# Set errors to bail out.
set -e
# Display commands
#set -v
BASE_DIR=~/shelltest_dropbox_filename_sanitizer
TEST_DIR="${BASE_DIR}/1398956253"
NIM_DIR="${TEST_DIR}/compiler"
NIM_BIN="${NIM_DIR}/bin/nimrod"
@gradha
gradha / install-libsodium.sh
Created August 16, 2016 19:38 — forked from jonathanpmartins/install-libsodium.sh
Install Libsodium on Ubuntu 14.04.3 LTS Trusty
#!/bin/bash
sudo add-apt-repository ppa:chris-lea/libsodium;
sudo echo "deb http://ppa.launchpad.net/chris-lea/libsodium/ubuntu trusty main" >> /etc/apt/sources.list;
sudo echo "deb-src http://ppa.launchpad.net/chris-lea/libsodium/ubuntu trusty main" >> /etc/apt/sources.list;
sudo apt-get update && sudo apt-get install libsodium-dev;
@gradha
gradha / c.sh
Last active January 4, 2016 03:38
Example of C code calling nimrod, and having troubles with the GC. See http://forum.nimrod-lang.org/t/349 and https://github.com/Araq/Nimrod/issues/856 for more info.
#!/bin/sh
PATH_TO_NIMROD=~/project/nimrod/root/bin/nim
PATH_TO_NIMBASE=~/project/nimrod/root/lib/nimbase.h
DEST_NIMBASE=nimcache/nimbase.h
# Force errors to fail script.
set -e
# Build library for ios.
@gradha
gradha / kill.nim
Last active January 2, 2016 07:08
Because we can
template usethis(v, e: expr): stmt {.immediate.} =
block:
using v
e
when isMainModule:
var a, s = "kill it"
usethis(s):
add(" with fire")
usethis(a):
@gradha
gradha / os.diff
Created December 31, 2013 15:35
Trying to make docstring appear in all platforms
diff --git a/lib/pure/os.nim b/lib/pure/os.nim
index d74cb1f..e404d8c 100644
--- a/lib/pure/os.nim
+++ b/lib/pure/os.nim
@@ -1481,7 +1481,19 @@ proc getTempDir*(): string {.rtl, extern: "nos$1", tags: [FReadEnv].} =
when defined(windows): return string(getEnv("TEMP")) & "\\"
else: return "/tmp/"
-when defined(windows):
+when defined(nimdoc):
@gradha
gradha / gist:8140318
Created December 26, 2013 23:49
Nimrod macro to unpack values from an array
import macros
macro unpackArray(arr, count: expr): expr {.immediate.} =
var source = "("
for i in 0..count.intVal-1:
if i > 0: source.add(',')
source.add(arr.toStrLit.strVal & "[" & $i & "]")
source.add(')')
result = parseStmt(source)
commit 9ec47a4f7dfa07a8b85c6365ac7c966261367060
Author: Grzegorz Adam Hankiewicz <gradha@imap.cc>
Date: Wed Dec 18 23:32:39 2013 +0100
Adds docstring to macros.newIdentDefs.
diff --git a/lib/core/macros.nim b/lib/core/macros.nim
index 5f0d60e..7caf4c5 100644
--- a/lib/core/macros.nim
+++ b/lib/core/macros.nim