Skip to content

Instantly share code, notes, and snippets.

View lynxluna's full-sized avatar
🎯
Focusing

Didiet lynxluna

🎯
Focusing
View GitHub Profile
@lynxluna
lynxluna / macprots.sh
Created March 21, 2012 11:19
macports upgrade
sudo port -n upgrade --force perl5.12 apr
sudo port upgrade subversion-perlbindings
@lynxluna
lynxluna / bigfile.c
Created April 9, 2012 01:41
Big File Reader
/*
* Copyright (c) 2012, Muhammad Sumyandityo Noor
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright notice,
@lynxluna
lynxluna / scopedptr.cpp
Created July 1, 2012 14:07
QScopedPointer
#include <QScopedPointer>
class PlayerData
{
public:
PlayerData() : health(100), atk(10), agi(10), name (new char[255]) {}
~PlayerData() { delete [] name; }
char *name;
int health, atk, agi;
};
@lynxluna
lynxluna / device.sh
Created July 6, 2012 00:26
Build Script for ZZiplib
NM=ntoarmv7-nm LD=ntoarmv7-ld STRIP=ntoramv7-strip RANLIB=ntoarm7-ranlib OBJDUMP=ntoarm7-objdump AR=ntoarmv7-ar CC=qcc -Vgcc_ntoarmv7le_gpp CFLAGS=-I${QNX_TARGET}/usr/include -I${QNX_TARGET}/usr/include/cpp/c -I${QNX_TARGET}/usr/include/cpp ./configure --build x86_64 --host arm --target arm --prefix=${HOME}/Projects/qnx-bin/device
@lynxluna
lynxluna / main.c
Created December 8, 2012 22:01
Win32 Game Loop
#include <Windows.h>
#include <tchar.h>
#define CURRENT_WND_CLASS _T("GameWndClass_Didiet")
#define DEF_CX 800
#define DEF_CY 600
LRESULT CALLBACK WndProc( HWND, UINT, WPARAM, LPARAM );
INT WINAPI _tWinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow )
@lynxluna
lynxluna / HarfBuzz-Build.md
Last active December 29, 2015 03:39
How to build HarfBuzz on BlackBerry 10 SDK

How to build harfbuzz on BlackBerry 10

  1. Install BlackBerry 10 SDK
  2. Start the environment variable by sourcing /Applications/Momentics.app/bbndk-env.sh
  3. Set the output dir for device and simulator e.g. $HOME/Projects/qnxlib/arm and $HOME/Projects/qnxlib/x86
  4. Execute gtkdocize
  5. Execute autoreconf --force --install --verbose
  6. Use this shell command to build
@lynxluna
lynxluna / .bash_profile
Created February 10, 2014 21:44
My most important bash profile to set up my prompt and console coloring.
export CLICOLOR=1
export LSCOLORS=ExFxCxDxBxegedabagacad
function gitify {
default_prompt="-----------------------------------------\n\e[37;1m[ \w ]\e[0m\] @ \h (\u) \n=> "
git rev-parse --git-dir >/dev/null 2>&1
if [ $? -eq 0 ]; then
light_green="\[\033[1;32m\]"
light_yellow="\[\033[1;33m\]"
# command to convert al-quran recitation from gq
ls sudais/*.mp3 | xargs -n 1 -P 10 -I % \
bash -c 'echo Processing %; avconv -v quiet -i % -f wav - | ~/neroAacEnc -ignorelength -cbr 64 -hev2 -if - -of "sudais-aac/$(basename %).aac" > /dev/null 2>&1'
@lynxluna
lynxluna / test.clj
Last active August 29, 2015 14:05
Mass Update a key
;; Example Nested Map
(def persons [{:name "asep" :address {:street "prikici" :city "tangsel"}}, {
:name "didiet" :address {:street "mijil" :city "sleman"}}])
;; Update Values
(defn update-vals [map vals f]
(reduce #(update-in % [%2] f) map vals))
;; experiment
(def asep (first persons))
(update-in asep [:address] (fn [m] (update-vals m [:street :city] clojure.string/upper-case)))
(defmacro def-if
"Define a symbol when one condition is met"
([condition sym true-expr]
(if condition `(def sym ~true-expr)))
([condition sym true-expr false-expr]
(if condition `(def sym ~true-expr) `(def sym ~false-expr))))