Skip to content

Instantly share code, notes, and snippets.

View alisaifee's full-sized avatar

Ali-Akber Saifee alisaifee

View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am alisaifee on github.
  • I am alisaifee (https://keybase.io/alisaifee) on keybase.
  • I have a public key whose fingerprint is 94EA CE54 A85A 8185 1040 7DB3 2FD2 EA66 CE5E ADD9

To claim this, I am signing this object:

View keybase.md

Keybase proof

I hereby claim:

  • I am alisaifee on github.
  • I am alisaifee (https://keybase.io/alisaifee) on keybase.
  • I have a public key whose fingerprint is 94EA CE54 A85A 8185 1040 7DB3 2FD2 EA66 CE5E ADD9

To claim this, I am signing this object:

@alisaifee
alisaifee / pootify.js
Created September 19, 2014 07:52
pootify
View pootify.js
(function switchText(node) {
var nodes = node.childNodes;
var poots = ["poot", "pooties", "pootify", "pootpoot"];
for (n in nodes) {
if (nodes[n].nodeType == 3) {
if (nodes[n].parentNode.nodeName.toLowerCase() != 'script') {
if (!/^\s+$/.test(nodes[n].value)) {
nodes[n].data = nodes[n].data.replace(/[a-zA-Z]+/g, function(w) {
if (w.match(/^(the|on|are|if|is|and|or|you|your|a|an)$/i)) return w;
return poots[Math.floor(Math.random() * poots.length)];
View ssh_port
<127.0.0.1> ESTABLISH CONNECTION FOR USER: ali
fatal: [127.0.0.1] => Traceback (most recent call last):
File "/Users/ali/_dev/_git/ansible/lib/ansible/runner/__init__.py", line 386, in _executor
exec_rc = self._executor_internal(host, new_stdin)
File "/Users/ali/_dev/_git/ansible/lib/ansible/runner/__init__.py", line 475, in _executor_internal
return self._executor_internal_inner(host, self.module_name, self.module_args, inject, port, complex_args=complex_args)
File "/Users/ali/_dev/_git/ansible/lib/ansible/runner/__init__.py", line 628, in _executor_internal_inner
conn = self.connector.connect(actual_host, actual_port, actual_user, actual_pass, actual_transport, actual_private_key_file)
File "/Users/ali/_dev/_git/ansible/lib/ansible/runner/connection.py", line 39, in connect
self.active = conn.connect()
@alisaifee
alisaifee / post-checkout
Created April 6, 2013 06:27
post-checkout script to print the jira summary for the branch you're on if its named with a jira or the summary of the jira of the last commit on that branch.
View post-checkout
#!/usr/bin/python
import os
import sys
import re
branch_name = os.popen("git svn info | grep URL | awk -F '/' '{print $NF}'").read()
expr = re.compile("([A-Z]+-[0-9]+)")
if expr.findall(branch_name):
jira = expr.findall(branch_name)[0]
os.system("jira-cli --oneline %s" % jira)
@alisaifee
alisaifee / suniq.cpp
Created June 24, 2012 13:09
faster version of sort | uniq -c | sort -n[r]
View suniq.cpp
#include <unordered_map>
#include <iostream>
#include <algorithm>
#include <fstream>
#include <map>
#include <list>
#include <iterator>
#include <unistd.h>
#include <stdio.h>
View coreutils-speedup
ali ~> wc -l
1000000 data_dupes.txt
ali ~> /bin/sort --version | grep coreutils
sort (coreutils) 5.2.1
ali ~> time bash -c "/bin/sort data_dupes.txt | uniq -c | sort -n > /dev/null"
12.91user 0.07system
ali ~> ~/bin/sort --version | grep coreutils
sort (GNU coreutils) 8.13
ali ~> time bash -c "~/bin/sort data_dupes.txt | ~/bin/uniq -c | ~/bin/sort -n > /dev/null"
3.86user 0.09system
View Reduce.java
import java.util.*;
import java.io.*;
class Reduce
{
public static void main( String [] args){
try{
String ref = args[0];
String data = args[1];
FileInputStream fref = new FileInputStream(ref);
FileInputStream fdata = new FileInputStream(data);
View data.csv
ufe3bcjyh2 0 0 1 1 4 3 1 2
kp7eaxgf4s 1 1 4 1 0 3 2 0
n6byucwlkd 1 0 1 2 1 3 0 4
gn45uy2jol 2 1 0 1 1 0 3 4
gdral6zjmq 1 2 0 4 1 3 1 0
nq3bz1ke6y 1 3 2 1 0 1 4 0
3figmnt4vx 1 4 0 0 1 2 3 1
i7uw2c8kfm 1 1 3 1 2 4 0 0
pjg4mxq8i5 4 2 1 0 1 1 3 0
73azrch16y 0 2 3 0 1 1 1 4
View reference.csv
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
ufe3bcjyh2
kp7eaxgf4s
n6byucwlkd
gn45uy2jol
gdral6zjmq
nq3bz1ke6y
3figmnt4vx