Skip to content

Instantly share code, notes, and snippets.

View limkokhole's full-sized avatar
🌴
On vacation

林果皞 limkokhole

🌴
On vacation
View GitHub Profile
@abdalin
abdalin / DividerItemDecorator.java
Created April 8, 2018 21:18
divider item decoration for recyclerview with space removed after last item
public class DividerItemDecorator extends ItemDecoration {
public static final int HORIZONTAL = LinearLayout.HORIZONTAL;
public static final int VERTICAL = LinearLayout.VERTICAL;
private Drawable mDivider;
private int mOrientation;
private final Rect mBounds = new Rect();
public DividerItemDecorator(Drawable divider, int orientation) {
anonymous
anonymous / gist:9c4623b17ff6bbe71d9a4aac072ff6a6
Created January 14, 2018 17:41
grep_quoted.sh
fb_friends()
{
args="'$@'"
eval "grep -a --color=auto -in --color=always $args ./test.txt"
echo "grep -a --color=auto -in --color=always $args ./test.txt"
echo $args
}
fb_friends "$@"
@koop
koop / ensure-cert-macos.sh
Created November 28, 2017 20:27
Ensures a certificate is in the macOS system keychain.
#!/bin/bash
# Usage
# $ ./install-cert-macos.sh "/path/to/cert"
CERT_PATH="$1"
# First, grab the SHA-1 from the provided SSL cert.
CERT_SHA1=$(openssl x509 -in "$CERT_PATH" -sha1 -noout -fingerprint | cut -d "=" -f2 | sed "s/://g")
# Next, grab the SHA-1s of any standard.dev certs in the keychain.
# Don't return an error code if nothing is found.
@cketti
cketti / android-26-sources.md
Last active August 14, 2019 12:08
Build your own android-26 sources

If you are annoyed that "Sources for Android 26" are not yet available via SDK manager, this might be for you:

  1. Collect source files
mkdir android-sdk-source-build
cd android-sdk-source-build

mkdir -p frameworks/base
@LiveOverflow
LiveOverflow / gql.py
Created June 21, 2017 19:43
Blind GQL injection and optimised binary search - A7 ~ Gee cue elle (misc) Google CTF 2017
import requests
import string
import random
import urllib
import time
import base64
from decimal import Decimal
# Blind GQL injection and optimised binary search - A7 ~ Gee cue elle (misc) Google CTF 2017
# https://www.youtube.com/watch?v=za_9hrq-ZuA
@kokjo
kokjo / doit.py
Last active June 3, 2019 15:52
Solution to CRC problem from asis ctf 2017
from pwn import *
s = log.waitfor("Calculating CRC reverse lookup table")
reverse_crc = {crc.crc_32(p16(i)): p16(i) for i in range(2**16)}
s.success()
e = ELF("./crcme_8416479dcf3a74133080df4f454cd0f76ec9cc8d")
r = process("./crcme_8416479dcf3a74133080df4f454cd0f76ec9cc8d")
@MemLeak
@augmt
augmt / organizing-photos-with-duplicate-and-similarity-checking.md
Last active September 12, 2025 14:35
Detecting similar and identical images using perseptual hashes

Detecting similar and identical images using perseptual hashes

Couple of my hobbies are travelling and photography. I love to take pictures and experiment with photography. Usually after my trips, I just copy the photos to either my iPad or couple of my external hard disks. After 10 years, I have over 200K photos distributed across several disks and machines. I had to find a way to organize these photos and create a workflow for future maintenance. In this post I want to address one of the issues I had to solve: ** finding duplicate images **.

First, I needed to find out what exactly is a duplicate image. Analysing my photos, I found couple of interesting things:

  1. Identical images: There were multiple copies of the same photo in different directories with different names.
  2. Similar images: I usually bracket (exposure compensate or flash compensate) important pictures. So I have photos that visually appear to be the same, but may be a little darker/lighter based on e
@kasparsd
kasparsd / AudienceNetworkPrebid.js
Created January 11, 2017 18:11
Facebook Audience Network
/*1484157874,,JIT Construction: v2773152,en_US*/
/**
* Copyright Facebook Inc.
*
* Licensed under the Apache License, Version 2.0
* http://www.apache.org/licenses/LICENSE-2.0
*/
try {
window.AudienceNetworkPrebid || (function(window, fb_fif_window) {
var apply = Function.prototype.apply;
@delimitry
delimitry / m3u8_decryptor.py
Created December 8, 2016 10:00
Python script for download and decrypt TS chunks from m3u8 file
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import re
import requests
import sys
from Crypto.Cipher import AES
@jherax
jherax / is-private-mode.js
Last active September 24, 2025 18:38
Detect if the browser is running in Private mode - Promise based (last update: Feb 2020)
/**
* Lightweight script to detect whether the browser is running in Private mode.
* @returns {Promise<boolean>}
*
* Live demo:
* @see https://output.jsbin.com/tazuwif
*
* This snippet uses Promises. If you want to run it in old browsers, polyfill it:
* @see https://cdn.jsdelivr.net/npm/es6-promise@4/dist/es6-promise.auto.min.js
*