Skip to content

Instantly share code, notes, and snippets.

@neevek
neevek / analyze_csv.pl
Last active November 3, 2020 17:07
A script for parsing CSV file and output report of the data in the file with support of specifying dimensions and indices.
#!/usr/bin/perl
use strict;
use warnings;
my @args = splice(@ARGV, 0);
my @dimens;
my @dimenNameArray;
my %indexNameHash;
@neevek
neevek / profapp.pl
Last active December 1, 2022 22:05
A script for profiling Android app by using adb to collect and constantly print CPU/memory/temperature/netstat information to the console.
#!/usr/bin/env perl -w
use strict;
use warnings;
use Time::HiRes qw(usleep);
use Term::ANSIColor;
my $pkgName = $ARGV[0];
my $watch = $ARGV[1];
my @args = splice(@ARGV, 1);
@neevek
neevek / caesarcipher.hs
Created March 25, 2018 13:30
CaesarCipher
import Data.Char
data CaesarCipherShift = CipherShift Int
caesarEncode :: CaesarCipherShift -> String -> String
caesarEncode _ [] = []
caesarEncode (CipherShift shiftCount) (x:xs)
| shiftedOrd > printableMax =
(chr $ ((shiftedOrd - 1 - printableMin) `mod` printableRange) + printableMin) :
(caesarEncode (CipherShift shiftCount) xs)
@neevek
neevek / RecyclerViewAdapterWrapper.java
Last active May 27, 2017 14:55
A RecyclerView.Adapter implementation acts as a wrapper of another RecyclerView.Adapter to support "HeaderView" and "FooterView" in a non-intrusive way.
/**
* Inspired by Qisen Tang, ref: http://www.woaitqs.cc/android/2017/04/11/new-way-to-add-header-and-footer.html
*
* <pre>
* <code>
* Usage:
*
* RecyclerViewAdapterWrapper adapterWrapper =
* RecyclerViewAdapterWrapper.wrap(new MyRecyclerViewAdapter())
* .headerView(headerView)
@neevek
neevek / nc_fileserver.sh
Last active August 29, 2020 15:42
A file server with nc
#!/bin/bash
port=$1
if [[ $# -ne 1 ]]; then
echo "usage: $0 <port>"
exit 1
fi
echo "will listen on $port, serve current directory"