Skip to content

Instantly share code, notes, and snippets.

@ri0day
ri0day / memcache_cli.sh
Created December 30, 2011 08:54
bash memcache cli
#!/bin/bash
#filename cm.sh
#author:wumin
#---Date:2011.12.29 pm---
#notice:not suport kind of ubuntu and debian system.(debian not suport /dev/tcp/host/port stye )
usage() {
format_usage="Usage:\n
@ri0day
ri0day / curl-saml-to-aws-role.sh
Last active July 25, 2023 03:06 — forked from lantrix/aws.sh
Bash functions to autenticate and assume roles in aws federated accounts - for ADFS3
#!/bin/bash
# bash functions to autenticate and assume roles in aws federated accounts
# required tools on $PATH - aws, date, curl, jq, libxml2-utils
# requried environment variables:
export AWS_CLI=`which aws`
# optional environment variable, to automatically assume a specific role when calling assume()
# AWS_ASSUME_ROLE=arn:aws:iam::369407384105:role/cross-account-federated-role
@ri0day
ri0day / aliyuncms.go
Created March 26, 2022 07:13
aliyuncms.go
package aliyuncms
import (
"encoding/json"
"fmt"
"strconv"
"strings"
"sync"
"time"
@ri0day
ri0day / discovery.go
Last active March 26, 2022 07:12
discovery.go
package aliyuncms
import (
"encoding/json"
"reflect"
"strconv"
"strings"
"sync"
"time"
__author__ = "Mark Allan B. Meriales"
# based from http://www.pythoncentral.io/watermark-images-python-2x/
# mine uses a picture as a watermark
from PIL import Image, ImageEnhance
def add_watermark(image_file, logo_file, opacity=1):
img = Image.open(image_file).convert('RGB')
logo = Image.open(logo_file)
@ri0day
ri0day / simple_gridfs_server.py
Created December 23, 2015 08:46 — forked from artisonian/simple_gridfs_server.py
A simple GridFS server built with Flask
from flask import Flask, request, redirect, url_for, make_response, abort
from werkzeug import secure_filename
from pymongo import Connection
from pymongo.objectid import ObjectId
from gridfs import GridFS
from gridfs.errors import NoFile
ALLOWED_EXTENSIONS = set(['txt', 'pdf', 'png', 'jpg', 'jpeg', 'gif'])
DB = Connection().gridfs_server_test
FS = GridFS(DB)
from threading import Thread
import Queue
import time
class TaskQueue(Queue.Queue):
def __init__(self, num_workers=1):
Queue.Queue.__init__(self)
self.num_workers = num_workers
self.start_workers()
@ri0day
ri0day / gist:1563407
Created January 5, 2012 02:30
php_hash_dos
<?php
$size = pow(2, 16);
for ($key = 0, $maxKey = $size - 1; $key <= $maxKey; ++$key)
{
$post_string = $post_string.$key . '=1' .'&';
}
//echo $post_string, "\n";
//create cURL connection
$curl_connection =
curl_init('http://127.0.0.1/a.php');
@ri0day
ri0day / mem.py
Created December 20, 2011 07:14
memcache http api
#/usr/bin/python
import pylibmc
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
import cgi
import logging
class example():
host = ""
server = ""
def __init__(self, host='10.10.93.16',port=11211):
@ri0day
ri0day / upload.py
Created December 7, 2011 09:14
file upload
#!/usr/bin/python
# Copyright Jon Berg , turtlemeat.com
# Modified by nikomu @ code.google.com
import string,cgi,time
from os import curdir, sep
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
from sys import exit
import os # os. path