Skip to content

Instantly share code, notes, and snippets.

@nandub
nandub / pkgsum.sh
Last active August 27, 2015 05:06
[ARCHLINUX] md5 and sha1 sum PKGBUILD updater
#!/usr/bin/env bash
#taken from https://bbs.archlinux.org/viewtopic.php?id=131666 by falconindy
awk -v newsums="$(makepkg -g)" '
BEGIN {
if (!newsums) exit 1
}
/^[[:blank:]]*(md|sha)[[:digit:]]+sums=/,/\)[[:blank:]]*$/ {
if (!i) print newsums; i++
@nandub
nandub / cross_build_16601.log
Last active August 29, 2015 13:56
CJDNS cross compiling for Beaglebone Black - SUCCESS
Compiler CC: arm-linux-gnueabihf-gcc
Compiler CFLAGS: -march=armv7-a -mtune=cortex-a8 -marm -mfloat-abi=hard -mfpu=neon -g
Compiler LDFLAGS: -march=armv7-a -mtune=cortex-a8 -marm -mfloat-abi=hard -mfpu=neon -g
Initialize 1ms
Copy dependencies
Build NaCl
Creating directories
Getting system type
System is [armeabi_neon]
Using premade plan at [node_build/plans/armeabi_neon_plan.json]
@nandub
nandub / outofmemory_dump
Created July 23, 2014 23:24
usb_flasher
[ 1533.233214] CPU: 0 PID: 572 Comm: rsyslogd Tainted: GF O 3.11.0-26-generic #45-Ubuntu
[ 1533.233215] Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox 12/01/2006
[ 1533.233217] 0000000000000000 ffff88003bc3f990 ffffffff816ea0a1 00000000000200da
[ 1533.233219] ffff88003bc3fa00 ffffffff816e4ffc 0000000000005589 0000000001320122
[ 1533.233220] 0000000000000000 0000000000000000 ffff88003afe0000 0000000000000000
[ 1533.233222] Call Trace:
[ 1533.233228] [<ffffffff816ea0a1>] dump_stack+0x45/0x56
[ 1533.233231] [<ffffffff816e4ffc>] dump_header+0x7f/0x1c2
[ 1533.233235] [<ffffffff81143189>] oom_kill_process+0x1a9/0x310
[ 1533.233238] [<ffffffff812ddf45>] ? security_capable_noaudit+0x15/0x20
@nandub
nandub / bb-kernel.log
Created August 1, 2014 21:14
BB Kernel
Building the kernel
Cloning into '/tmp/bb-kernel'...
Switched to a new branch '3.14'
Branch 3.14 set up to track remote branch 3.14 from origin.
Cloning into '.'...
Checking out files: 6% (3263/47433)
Checking out files: 7% (3321/47433)
Checking out files: 8% (3795/47433)
Checking out files: 9% (4269/47433)
Checking out files: 10% (4744/47433)
@nandub
nandub / gist:fd91fcfcc751149fe7ba
Created August 6, 2014 16:49
crosstool-ng fails on osx without zconf patch
In file included from zconf.tab.c:234:
./zconf.hash.c:177:8: warning: implicit declaration of function 'offsetof' is invalid in
C99 [-Wimplicit-function-declaration]
{offsetof(struct kconf_id_strings_t, kconf_id_strings_str2), ...
^
./zconf.hash.c:177:17: error: expected expression
{offsetof(struct kconf_id_strings_t, kconf_id_strings_str2), ...
^
./zconf.hash.c:178:17: error: expected expression
{offsetof(struct kconf_id_strings_t, kconf_id_strings_str3), ...
Traceback (most recent call last):
File "/usr/local/Cellar/mitmproxy/0.10.1/libexec/bin/mitmproxy", line 3, in <module>
from libmproxy import proxy, console, cmdline
File "/usr/local/Cellar/mitmproxy/0.10.1/libexec/lib/python2.7/site-packages/libmproxy/proxy.py", line 3, in <module>
from OpenSSL import SSL
File "/usr/local/Cellar/mitmproxy/0.10.1/libexec/vendor/lib/python2.7/site-packages/OpenSSL/__init__.py", line 8, in <module>
from OpenSSL import rand, crypto, SSL
File "/usr/local/Cellar/mitmproxy/0.10.1/libexec/vendor/lib/python2.7/site-packages/OpenSSL/rand.py", line 11, in <module>
from OpenSSL._util import (
File "/usr/local/Cellar/mitmproxy/0.10.1/libexec/vendor/lib/python2.7/site-packages/OpenSSL/_util.py", line 3, in <module>

Keybase proof

I hereby claim:

  • I am nandub on github.
  • I am nandub (https://keybase.io/nandub) on keybase.
  • I have a public key whose fingerprint is 7866 B614 1FBD 85A8 1681 34CD 040D 127C 758F E9CA

To claim this, I am signing this object:

String a = String.valueOf(2); //integer to numeric string
int i = Integer.parseInt(a); //numeric string to an int
BufferedWriter out = null;
try {
out = new BufferedWriter(new FileWriter(”filename”, true));
out.write(”aString”);
} catch (IOException e) {
// error processing code
} finally {
if (out != null) {
out.close();
}
java.util.Date = java.text.DateFormat.getDateInstance().parse(date String);
//or
SimpleDateFormat format = new SimpleDateFormat( "dd.MM.yyyy" );
Date date = format.parse( myString );