Skip to content

Instantly share code, notes, and snippets.

@judotens
judotens / cari.c
Last active December 29, 2015 16:29
Find an insensitive string in big text file. faster than cat and grep. supports multiple keywords, separated by space. no regex support.
/* cari string di file, case insensitive
support multiple keyword, tapi bukan regex. diisah by spasi aja
find an insensitive string in big raw text. faster than cat and grep.
supports multiple keywords, separated by space. no regex support.
@judotens
./cari bigfile.txt keyword
@judotens
judotens / acak.sh
Last active December 29, 2015 01:49
Randomize the input lines using bash
#!/bin/bash
# randomize the input lines
# cat artikel.txt | ./acak.sh
awk 'BEGIN{srand() }
{ lines[++d]=$0 }
END{
while (1){
if (e==d) {break}
@judotens
judotens / ubigram.sh
Last active December 29, 2015 01:49
Find top unigram & bigram using bash
#!/bin/bash
# cat artikel.txt | ./ubigram.sh
# results sorted by frequences
# freq, keyword
cat "$@" |
tr -cs "a-zA-Z0-9" '\012' | tr '[:upper:]' '[:lower:]' |
{
old="aaa."
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" """
import json
from urllib2 import urlopen
from lxml.html import document_fromstring
from lxml.cssselect import CSSSelector as cs
@judotens
judotens / clean.sh
Last active August 29, 2015 14:02
Botnet .IptabLes & .IptabLex cleaner
# botnet .IptabLes & .IptabLex cleaner
# tested on my ec2 based on Amazon AMI
# here i attached my version -> http://filebin.ca/1PPeWObrq63q/IptabLesx.zip
# https://malwr.com/analysis/MDIyMmEzZmU1ZjIzNGU4ZGIxNTQ1NmViNmYxNjc0NTQ/
# @judotens
# 1.1M
getsetup_sum="27fff3d371fff67bf14cb91e7b1f6623"

Share Counts

I have always struggled with getting all the various share buttons from Facebook, Twitter, Google Plus, Pinterest, etc to align correctly and to not look like a tacky explosion of buttons. Seeing a number of sites rolling their own share buttons with counts, for example The Next Web I decided to look into the various APIs on how to simply return the share count.

If you want to roll up all of these into a single jQuery plugin check out Sharrre

Many of these API calls and methods are undocumented, so anticipate that they will change in the future. Also, if you are planning on rolling these out across a site I would recommend creating a simple endpoint that periodically caches results from all of the APIs so that you are not overloading the services will requests.

Twitter

#!/usr/bin/python
# Quick and dirty demonstration of CVE-2014-0160 by Jared Stafford (jspenguin@jspenguin.org)
# The author disclaims copyright to this source code.
import sys
import struct
import socket
import time
import select