Skip to content

Instantly share code, notes, and snippets.

View cab404's full-sized avatar
💜
s p a r k l i n g u n i c o r n p r i n c e s s ™

Cabia Rangris cab404

💜
s p a r k l i n g u n i c o r n p r i n c e s s ™
View GitHub Profile
@cab404
cab404 / colorize.java
Last active August 29, 2015 14:09
Utility method for coloring text
public static int indexOf(CharSequence seq, int start, char ch) {
for (int i = start; i < seq.length(); i++)
if (ch == seq.charAt(i)) return i;
return -1;
}
public static int indexOf(CharSequence seq, char ch) {
return indexOf(seq, 0, ch);
}
import android.content.res.Resources;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;
import java.util.ArrayList;
import java.util.List;
/**
* Simple class for fast View from ViewGroup retrieving.
* Performs some little optimizations, such as ListView ignoring.
@cab404
cab404 / JSONTemplate.java
Last active August 29, 2015 14:10
JSONTemplate
package com.cab404.jsontemplate;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
package com.cab404;
import java.nio.charset.Charset;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
/**
@cab404
cab404 / hw.asm
Last active August 29, 2015 14:18
; cab404: int to str, with negative numbers and stuff
global _start
section .data
test_data: dq -192734, 23400, -9223372036854775808, 9223372036854775807
test_len: equ ($-test_data)/8
section .bss
buf: resb 50 ; buffer, so we can print what we got.
buf_len: equ $-buf
#!/bin/sh
# This script gets NetworkManager out of suspend.
case "$1" in
resume|thaw)
nmcli radio wifi off
nmcli radio wifi on
;;
esac
package com.cab404.fnst;
/**
* Fenechka scheme
* <p/>
* Created at 11:19 on 26/07/15
*
* @author cab404
*/
public class StandartTemplate {
def rgb2hsv(r, g, b):
v = max(r,g,b)
l = min(r,g,b)
sxf = (1.0 / 6)
trd = (1.0 / 3)
# actual start
s = l / v;
#!/bin/bash
# Simple network scan based on ICMP echo requests.
# Something for when arp scanning is not working.
# @author cab404
if [[ -z $2 ]]; then
echo "specify mask and bit length like so: '192.168.1.0 24'"
exit 0;
fi
@cab404
cab404 / rene.sh
Last active April 12, 2016 19:17
#!/bin/bash
# Simple sed-based file renamer
if [[ $1 == "" ]]; then
echo "No sed expression specified"
exit 0
fi
DATA=$(ls -1q); IFS=$'\n';
for A in $DATA; do
B=$(echo "$A" | sed -e "$1")