Skip to content

Instantly share code, notes, and snippets.

View amalmurali47's full-sized avatar
🌴
On vacation

Amal Murali amalmurali47

🌴
On vacation
View GitHub Profile
// Paste into Firebug or Chrome Dev Tools console
// when viewing a page with multiple checkboxes.
(function(d) {
var input = d.querySelectorAll('input[type="checkbox"]');
var i = input.length;
while (i--) {
input[i].checked = true;
}
@amalmurali47
amalmurali47 / gist:6028653
Last active October 18, 2020 23:30
How to join ##php channel on freenode?

How to join ##php channel on freenode?

  1. Get an IRC client. I recommend Hexchat. Any IRC client will do. You can even use freenode webchat, if you don't want to install one.
  2. Connect to freenode. If you're using HexChat, just type /server freenode and it should connect you.
  • The ##php channel requires you to be identified to NickServ to join. To register your nickname, type the following command:

      /msg nickserv register Y0uR-Str0nG-P@SsW0rd valid-email@addre.ss
    
  1. Check your email inbox (spam/junk too) and verify the account by executing the command in the email.
<?php
/*
Took 10.474477052689 seconds
Took 12.499534845352 seconds
*/
set_time_limit( 0 );
$searchText = 'Page and Brin originally nicknamed THEIR new search engine "BackRub", because the system checked backlinks to estimate the importance of a site.';
<?php
// My original function
function max_length($array) {
$max = 0;
foreach($array as $child) {
if(count($child) > $max) {
$max = count($child);
}
}
return $max;
@amalmurali47
amalmurali47 / gist:9213340
Created February 25, 2014 17:11
array_rand() vs shuffle() - Benchmark
<pre><?php
$arr = array(
array(
"image" => "",
"title" => "Open 7 days.",
"text" => "We’re open 7 days a week."
),
array(
"image" => "",
@amalmurali47
amalmurali47 / extract.sh
Created June 25, 2017 19:09
Extract Anything
function extract() {
filename=$1
if [ -f $filename ]; then
case $filename in
*.tar.xz) tar xvfJ $filename ;;
*.tar.gz) tar --gzip -xvf $filename ;;
*.tar.bz2) tar --bzip2 -xvf $filename ;;
*.tar) tar -xvf $filename ;;
*.tgz) tar --gzip -xvf $filename ;;
*.tbz2) tar --bzip2 -xvf $filename ;;
@amalmurali47
amalmurali47 / solve.py
Created July 26, 2017 21:15
Automation
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import selenium, re
from selenium import webdriver
from selenium.webdriver.support.wait import WebDriverWait
browser = None
should_log = False
from scrapy.linkextractors import LinkExtractor
from scrapy.spiders import CrawlSpider, Rule
from scrapy.item import Item, Field
import logging
logger = logging.getLogger()
class WebItem(Item):
url = Field()
title = Field()
#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <numeric>
#include <cmath>
#include <algorithm>
#include <list>
#include <map>
#include <iterator>
#!/bin/bash
vpnbook_pass=$(curl -sL vpnbook.com | grep -ioP -m1 "<li><strong>Password: \K(\S+)(?=</strong></li>)" | tr -d '\n')
echo -e "vpnbook\n$vpnbook_pass"