Skip to content

Instantly share code, notes, and snippets.

View hasantayyar's full-sized avatar
⌨️
AFK

Hasan Tayyar Beşik hasantayyar

⌨️
AFK
View GitHub Profile
@hasantayyar
hasantayyar / urlencoderbookmarklet.js
Created December 10, 2011 18:14
url encoder bookmarklet
javascript:void(prompt('Encoded:',encodeURIComponent(prompt('Stringtoencode:'))))
@hasantayyar
hasantayyar / UDPListener.cs
Created January 9, 2012 10:37
UDPListener
using System;
using System.Net;
using System.Net.Sockets;
using System.Text;
public class UDPListener
{
private const int listenPort = 11000;
private static void StartListener()
{
@hasantayyar
hasantayyar / UDPListener.cpp
Created January 9, 2012 10:37
UDPListener
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
@hasantayyar
hasantayyar / passgen.sh
Created January 12, 2012 22:06
strong and easy to remember password generator
#seen on http://www.unixmen.com/11-useful-commands-for-linuxunix-administrators/
read -s pass; echo $pass | md5sum | base64 | cut -c -16
@hasantayyar
hasantayyar / fbgetalbumphotos.js
Created February 29, 2012 09:43
Get Facebook Albums and Album Photos
function getAlbumPhotos(albumid){
FB.api("/"+albumid+"/photos",function(response){
var photos = response["data"];
var html = "count "+photos.length;
for(var i=0;i<photos.length;i++) {
var images = photos[i]["images"];
html+= "Photo "+(v+1);
html+= '<img src="'+images[(images.length-1)]["source"]+'" />';
var tmp = "";
for(var j = 0 ;j<images.length;j++) {
@hasantayyar
hasantayyar / randomcommitmessage.php
Created February 29, 2012 09:46
get radom commit message from whatthecommit
<?php
$content = file_get_contents("http://whatthecommit.com/");
preg_match("#<p>(.*)#i",$content,$match);
$message = $match[1];
echo $message;
@hasantayyar
hasantayyar / countembeded.js
Created March 27, 2012 08:22
mongodb count embeded objects by an atrribute
var map = function() { emit(this.e, { notifications : this.notifications});};
var reduce = function(key, values) {
var count = 0;
values.forEach(function(docs) {
for(var doc in docs.notifications){
if(docs.notifications[doc].date>1332836355){
count+=1;
}
}
@hasantayyar
hasantayyar / disposablemails.php
Created April 17, 2012 07:35
my disposable email list to prevent abusing
<?php
// has also some orther sites that is not a disposable mail service
$disposalbe = array(
'veryrealemail.com', // mirror of mailinator
'rtrtr.com',
'bobmail.info',
'tradermail.info', // mirror of mailinator
'omurtlak.com',
'mp3dinleq.com', // top spammer
@hasantayyar
hasantayyar / MostUsedCommands.sh
Created April 25, 2012 22:03 — forked from csanz/MostUsedCommands.md
Most used commands
history|awk '{print $2}'|awk 'BEGIN {FS="|"} {print $1}'|sort|uniq -c|sort -r
@hasantayyar
hasantayyar / reduceimage.sh
Created May 16, 2012 09:14
reduce and rename image
if [[ !-d "reduced" ]]; then
mkdir "reduced";
fi
b=0
for i in `ls -v`; do convert -quality 50 $i reduced/`printf %03d $b`.jpg; ((b++)); done