Skip to content

Instantly share code, notes, and snippets.

View chankeypathak's full-sized avatar
Commit all day, everyday!

Chankey Pathak chankeypathak

Commit all day, everyday!
View GitHub Profile
@EricDuminil
EricDuminil / trie.py
Last active December 31, 2023 06:04 — forked from atiking/regexp-trie.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
#author: rex
#blog: http://iregex.org
#filename trie.py
#created: 2010-08-01 20:24
#source uri: http://iregex.org/blog/trie-in-python.html
# escape bug fix by fcicq @ 2012.8.19
@brianwisti
brianwisti / hugo-theme-demo.py
Created December 28, 2015 02:12
First pass at previewing randomgeekery.org content with all themes in Hugo themes repository
#!/usr/bin/env python3
import os
import os.path
import subprocess
import time
from splinter import Browser
def is_theme_dir(folder, item):
@anhldbk
anhldbk / Selenium.Python.InjectJS.py
Last active April 15, 2023 03:53
Inject jQuery into Selenium Driver
from selenium import webdriver
driver = webdriver.Firefox()
driver.get('https://www.facebook.com/')
with open('jquery-1.9.1.min.js', 'r') as jquery_js:
jquery = jquery_js.read() #read the jquery from a file
driver.execute_script(jquery) #active the jquery lib
driver.execute_script("$('#email').text('anhld')")
@bsweger
bsweger / useful_pandas_snippets.md
Last active April 19, 2024 18:04
Useful Pandas Snippets

Useful Pandas Snippets

A personal diary of DataFrame munging over the years.

Data Types and Conversion

Convert Series datatype to numeric (will error if column has non-numeric values)
(h/t @makmanalp)

@philfreo
philfreo / gist:7257723
Created October 31, 2013 21:44
Facebook Perl source code from 2005. When browsing around thefacebook.com in 2005 the server spit out some server-side source code rather than running it. I believe this was for their old graph feature that let you visualize the graph between all your friends. The filename is `mygraph.svgz` and contains some gems such as a commented out "zuck" d…
#!/usr/bin/perl
use Mysql;
use strict;
use vars qw($school_name);
use vars qw($pass);
require "./cgi-lib.pl";
@jasongaylord
jasongaylord / IEUserAgentTest.html
Last active October 10, 2023 08:04
A sample JavaScript file to detect IE compatibility mode and version. This is not recommended unless absolutely needed as features should be detected instead.
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Testing IE Compatibility Mode</title>
<script src="ieUserAgent.js" type="text/javascript"></script>
</head>
<body>
<div id="results">Results:</div>
<script type="text/javascript">
var val = "IE" + ieUserAgent.version;
@scraperdragon
scraperdragon / chrome2requests.py
Created August 22, 2012 11:25
Convert Chrome headers to Python's Requests dictionary
dict([[h.partition(':')[0], h.partition(':')[2]] for h in rawheaders.split('\n')])
@douglas
douglas / update_git_repos.sh
Created October 14, 2011 15:04
Update all git repositories under a base directory
#!/bin/bash
# store the current dir
CUR_DIR=$(pwd)
# Let the person running the script know what's going on.
echo "\n\033[1mPulling in latest changes for all repositories...\033[0m\n"
# Find all git repositories and update it to the master latest revision
for i in $(find . -name ".git" | cut -c 3-); do
@mlafeldt
mlafeldt / scp_demo.py
Created February 24, 2011 09:09
[Python] paramiko examples
#!/usr/bin/env python
import sys, paramiko
if len(sys.argv) < 5:
print "args missing"
sys.exit(1)
hostname = sys.argv[1]
password = sys.argv[2]