Skip to content

Instantly share code, notes, and snippets.

//http://viralpatel.net/blogs/2009/01/java-singleton-design-pattern-tutorial-example-singleton-j2ee-design-pattern.html
public class SimpleSingleton {
private static SimpleSingleton singleInstance = new SimpleSingleton();
//Marking default constructor private
//to avoid direct instantiation.
private SimpleSingleton() {
}
@nandub
nandub / ProtobufEnvelope.java
Created May 1, 2011 05:52
ProtobufEnvelope - allows creating a protobuf message without the .proto file dynamically.
import com.google.protobuf.DescriptorProtos;
import com.google.protobuf.Descriptors;
import com.google.protobuf.DynamicMessage;
import com.google.protobuf.Message;
import java.util.HashMap;
/**
* ProtobufEnvelope - allows creating a protobuf message without the .proto file dynamically.
*
@nandub
nandub / GNAT_LLVM_make_error.log
Created June 4, 2020 01:59
GNAT LLVM Make Error
make
/Library/Developer/CommandLineTools/usr/bin/make -C llvm-interface build gnatlib-automated
mkdir -p obj obj-tools bin gnat_src/vast
for f in `cd /opt/gnat-llvm/llvm-interface/gnat_src; ls xtreeprs.adb xnmake.adb xutil.ad? *-tmpl xsnamest.adb sinfo.ads treeprs.adt nmake.adt xoscons.adb xutil.ads xutil.adb`; \
do \
cp -p /opt/gnat-llvm/llvm-interface/gnat_src/$f obj-tools; \
done
cd obj-tools && gnatmake -q -j0 xtreeprs xnmake xsnamest xoscons && \
./xtreeprs && ./xnmake && ./xsnamest && \
mv -f nmake.ads nmake.adb treeprs.ads ../obj && \
@nandub
nandub / gist:978c5cdc6721293e59653fa3ae5ed313
Created July 30, 2018 19:59
Nook Tablet BNRV250 Root and Resources
#Rooting Nook Tablet BNRV250
- https://blog.the-ebook-reader.com/2012/03/11/root-a-nook-tablet-using-a-memory-card-super-easy/
#Resources for CM and AOSP / Lineage OS
- https://notredame.app.box.com/s/26a4bygh9vbaw7jjq08xr5evomvaw5ww/folder/3220985318
- https://forum.xda-developers.com/nook-tablet/general/how-to-installing-aosp-android-7-0-t3578665
- https://forum.xda-developers.com/nook-tablet/development/cm-14-1-nook-tablet-acclaim-16gb-model-t3499226/page11
#How to Build Lineage OS
- https://forum.xda-developers.com/chef-central/android/how-to-build-lineageos-14-1-t3551484
@nandub
nandub / nodenv-setup
Created June 16, 2018 03:57
Setup Nodenv Environment
#!/bin/bash
arg=$1
if [ "$arg" = "all" ]; then
nodenv-setup
nodenv install 4.8.4
nodenv install 5.12.0
nodenv install 6.14.2
nodenv install 7.10.1
@nandub
nandub / form_input_filler.js
Last active May 7, 2018 23:30
greasemonkey script - form input filler
// ==UserScript==
// @name Form input filler
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js
// ==/UserScript==
//var $ = unsafeWindow.jQuery;
// From http://papermashup.com/read-url-get-variables-withjavascript/
// Added: decodeURI
function getUrlVars() {
@nandub
nandub / OBS_Mitmproxy_Log
Created December 11, 2017 18:14
Build failure of home:nandub:MyAppImages/Mitmproxy in AppImage/x86_64
Visit https://build.opensuse.org/package/live_build_log/home:nandub:MyAppImages/Mitmproxy/AppImage/x86_64
Package home:nandub:MyAppImages/Mitmproxy failed to build in AppImage/x86_64
Check out the package for editing:
osc checkout home:nandub:MyAppImages Mitmproxy
Last lines of build log:
[ 520s] ++ sed -e s,:,:/,g -e s,//,/,g
[ 520s] + ZSYNC_URL=http://download.opensuse.org/repositories/home:/nandub:/MyAppImages/AppImage
/usr/local/Homebrew/Library/Homebrew/brew.rb (Formulary::TapLoader): loading /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/ack.rb
/usr/local/Homebrew/Library/Homebrew/brew.rb (Formulary::TapLoader): loading /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/acme.rb
/usr/local/Homebrew/Library/Homebrew/brew.rb (Formulary::TapLoader): loading /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/adns.rb
/usr/local/Homebrew/Library/Homebrew/brew.rb (Formulary::TapLoader): loading /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/ant.rb
/usr/local/Homebrew/Library/Homebrew/brew.rb (Formulary::TapLoader): loading /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/app-engine-python.rb
/usr/local/Homebrew/Library/Homebrew/brew.rb (Formulary::TapLoader): loading /usr/local/Homebrew/Library/Taps/homebrew/homebrew-dupes/apple-gcc42.rb
/usr/local/Homebrew/Library/Homebrew/brew.rb (Formulary::TapLoader): loading /usr/local/Homebrew/Library/Taps/homebrew/
@nandub
nandub / prepare-commit-msg
Last active July 19, 2016 22:21 — forked from patrickkettner/prepare-commit-msg
This git hook appends "[ci skip]" to your commit message if the readme file is the only thing being touched. Read more about it here - http://about.travis-ci.org/docs/user/how-to-skip-a-build/
#!/usr/bin/env bash
# a list of all files that are changing with this commit
FILES_CHANGING=$(git diff --cached --name-only --diff-filter=ACM)
# if there is only one file changing
if [ $(echo "$FILES_CHANGING" | wc -l) -eq 1 ]; then
# and that file is a readme
README_CHANGING=$(echo $FILES_CHANGING | grep -Ei "readme(.md|.txt)?$")
@nandub
nandub / cjdroute_cross_build_31381.gdb
Created January 2, 2014 08:29
CJDNS cross compiling for Beaglebone Black using NEON fails
gdb cjdroute_cross_build_31381
GNU gdb (GDB) 7.4.1-debian
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "arm-linux-gnueabihf".
For bug reporting instructions, please see: