Skip to content

Instantly share code, notes, and snippets.

ugo candycode

  • Australia
Block or report user

Report or block candycode

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 ld-preload-intercept-method.cpp
// this file is an example of how to intercept a C++ method by using the
// LD_PRELOAD environment variable of the GNU dynamic linker.
//
// it works like this:
//
// 1) define a method that will have the same symbol as the intercepted
// method when compiled. For example, the method Foo::getValue()
// defined here has the mangled symbol "_ZNK3Foo8getValueEv".
// tools like nm, objdump or readelf can display the symbols of
// binaries.
@candycode
candycode / flv2mp4.sh
Created Mar 22, 2016
Convert multiple files with ffmpeg
View flv2mp4.sh
for f in ../flv/*.flv; do echo "Converting $f"; g=`basename $f .flv`; ffmpeg -i ../flv/$f -c:v libx264 -crf 19 -strict experimental $g.mp4 || echo FAILED; done
View core.clj
(ns apples.core
(:require [play-clj.core :refer :all]
[play-clj.g2d :refer :all]
[play-clj.math :refer :all]))
(declare apples main-screen)
(def speed 14)
(defn- get-direction []
(cond
@candycode
candycode / chrome-disable-security-for-local-access
Created Apr 6, 2014
Disable web security to access local resources as needed
View chrome-disable-security-for-local-access
FROM STACK OVERFLOW
http://stackoverflow.com/questions/3102819/disable-same-origin-policy-in-chrome
$ open -a Google\ Chrome --args --disable-web-security
For Linux run:
$ google-chrome --disable-web-security
Also if you're trying to access local files for dev purposes like AJAX or JSON, you can use this flag too.
-–allow-file-access-from-files
@candycode
candycode / extract-video-frames
Created Apr 6, 2014
extract frames from video
View extract-video-frames
# ffmpeg -i file.mp4 -y -ss 5 -an -sameq -f image2 -r 1/5 filename%03d.jpg
-y
Overwrite output files
-ss position
Seek to given time position in seconds. "hh:mm:ss[.xxx]" syntax is also supported
-an
Disable audio recording
@candycode
candycode / cef-qt-ubuntu.sh
Created Mar 10, 2014
Build chromium embedded framework app w/ qt on ubuntu 13.04
View cef-qt-ubuntu.sh
#!/bin/sh
#NOTE: need to set L to the proper libcef_dll top level dir: ../out/Release/obj.target
g++ -I../ -o qt qt.cpp cefw.cpp `pkg-config --cflags gtk+-2.0` \
`pkg-config --libs gdk-2.0` \
-L../out/Release/obj.target -L../Release -lcef_dll_wrapper -lcef `pkg-config --cflags QtCore QtGui --libs QtCore QtGui`
@candycode
candycode / image-arraybuffer.js
Created Mar 7, 2014
Create a jpg image from ArrayBuffer data
View image-arraybuffer.js
// Simulate a call to Dropbox or other service that can
// return an image as an ArrayBuffer.
var xhr = new XMLHttpRequest();
// Use JSFiddle logo as a sample image to avoid complicating
// this example with cross-domain issues.
xhr.open( "GET", "http://fiddle.jshell.net/img/logo.png", true );
// Ask for the result as an ArrayBuffer.
xhr.responseType = "arraybuffer";
@candycode
candycode / SyncQueue.h
Created Feb 21, 2014
Synchronized C++11 queue implementation
View SyncQueue.h
//sync queue implementation
#pragma once
#include <condition_variable>
#include <mutex>
#include <deque>
//------------------------------------------------------------------------------
//synchronized queue (could be an inner class inside Executor):
// - acquire lock on insertion and notify after insertion
// - on extraction: acquire lock then if queue empty wait for notify, extract
@candycode
candycode / libwebsocket-server.c
Last active Aug 29, 2015
libwebsocket server
View libwebsocket-server.c
#include <stdio.h>
#include <stdlib.h>
#include <libwebsockets.h>
#include <string.h>
static int callback_http(struct libwebsocket_context * this,
struct libwebsocket *wsi,
enum libwebsocket_callback_reasons reason, void *user,
void *in, size_t len)
@candycode
candycode / mathjax-syntaxhughlighter.html
Last active Dec 20, 2015
MathJax + SyntaxHighlighter header
View mathjax-syntaxhughlighter.html
<!-- Syntax Highlighter Additions START -->
<link href='http://alexgorbatchev.com/pub/sh/current/styles/shCore.css' rel='stylesheet' type='text/css'/>
<link href='http://alexgorbatchev.com/pub/sh/current/styles/shThemeDefault.css' rel='stylesheet' type='text/css'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shCore.js' type='text/javascript'></script>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushBash.js' type='text/javascript'></script>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushCpp.js' type='text/javascript'></script>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushCss.js' type='text/javascript'></script>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushDiff.js' type='text/javascript'></script>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJScript.js' type='text/javascript'></script>
You can’t perform that action at this time.