Skip to content

Instantly share code, notes, and snippets.

View alshell7's full-sized avatar

Owais alshell7

View GitHub Profile
@hay
hay / gist:1351230
Last active March 29, 2024 16:36
Enterprisify your Java Class Names!
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Enterprisify your Java Class Names! (by Hay Kranen)</title>
<style>
body {
background: white;
text-align: center;
@bamthomas
bamthomas / pub_sub_redis.py
Created November 28, 2012 22:16
Pub/Sub redis python
from multiprocessing.process import Process
import time
import redis
def pub(myredis):
for n in range(10):
myredis.publish('channel','blah %d' % n)
time.sleep(5)
def sub(myredis, name):
@chrisboulton
chrisboulton / ip_blacklist.lua
Last active April 2, 2024 10:43
Redis based IP blacklist for Nginx (LUA)
-- a quick LUA access script for nginx to check IP addresses against an
-- `ip_blacklist` set in Redis, and if a match is found send a HTTP 403.
--
-- allows for a common blacklist to be shared between a bunch of nginx
-- web servers using a remote redis instance. lookups are cached for a
-- configurable period of time.
--
-- block an ip:
-- redis-cli SADD ip_blacklist 10.1.1.1
-- remove an ip:
@xalexchen
xalexchen / KeyframeAnimation.java
Created September 17, 2013 05:44
This example shows how to use AnimationDrawable to construct a keyframe animation where each frame is shown for a specified duration.
import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.drawable.AnimationDrawable;
import android.graphics.drawable.BitmapDrawable;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.graphics.Bitmap;
/**
* Created by paveld on 3/6/14.
*/
public class FastBlur {
public static Bitmap doBlur(Bitmap sentBitmap, int radius, boolean canReuseInBitmap) {
// Stack Blur v1.0 from
@wdullaer
wdullaer / install.sh
Last active April 2, 2024 20:33
Install Latest Docker and Docker-compose on Ubuntu
# Ask for the user password
# Script only works if sudo caches the password for a few minutes
sudo true
# Install kernel extra's to enable docker aufs support
# sudo apt-get -y install linux-image-extra-$(uname -r)
# Add Docker PPA and install latest version
# sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
# sudo sh -c "echo deb https://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list"
@finnigja
finnigja / dnsdiff.py
Last active July 26, 2022 02:36
Script for comparing DNS lookup results across multiple resolvers
#!/usr/bin/env python
#
# DNS Result Comparison Utility
# Author: https://twitter.com/chair6
#
import argparse
import dns.resolver
import dns.rdatatype
from collections import defaultdict
@TheRook
TheRook / spf.py
Last active March 4, 2024 18:27 — forked from moloch--/spf.py
#!/usr/bin/env python
import dns.resolver
import dns.name
#import netaddr
from urlparse import urlparse
INFO = "\033[1m\033[36m[*]\033[0m "
@sureshdsk
sureshdsk / facebook-graph-api-page.py
Last active March 25, 2019 15:23
Get number of likes of a facebook page using graph api in python
# http://www.idiotinside.com/2015/02/13/get-number-of-likes-of-a-facebook-page-using-graph-api-in-python/
import urllib2
import json
def get_page_data(page_id,access_token):
api_endpoint = "https://graph.facebook.com/v2.4/"
fb_graph_url = api_endpoint+page_id+"?fields=id,name,likes,link&access_token="+access_token
try:
api_request = urllib2.Request(fb_graph_url)
@fahimbabarpatel
fahimbabarpatel / Mongodb restore and dump commands via json, bson and csv.md
Last active June 1, 2023 10:11
Mongodb restore and dump commands via json, bson and csv

NOTE -

  • Remove -h option if you are doing operation on same machine
  • Remove -u , -p option if your database don't have username and password

Binary

Import database

mongorestore -h IP:port -d DB_Name -u user_name -p password <input db directory>