This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def erdos_renyi(n, m): | |
| g = snap.TNEANet.New() | |
| g.AddIntAttrE("weightInt", 0) | |
| node_ids = [x for x in range(n)] | |
| for x in node_ids: | |
| g.AddNode(x) | |
| counter = 0 | |
| while counter < m: | |
| node1 = random.choice(node_ids) | |
| node2 = random.choice(node_ids) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import networkx as nx | |
| import csv | |
| import random | |
| from sklearn.neural_network import MLPClassifier | |
| from sklearn.metrics import accuracy_score | |
| def gml_to_edgelist(f): | |
| g = nx.read_gml(f) | |
| nx.write_edgelist(g, 'edgelist.csv', delimiter=',') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| cv() { | |
| strings ~/.local/share/clipit/history | fzf --ansi --multi | xclip -selection clipboard | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| alias score="curl http://static.cricinfo.com/rss/livescores.xml >/dev/null 2>&1 | grep -m 1 'Sri Lanka' | grep -o -P '(?<=\>).*(?=\<)'" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| curl -u KEY: -X POST https://api.pushbullet.com/v2/pushes --header 'Content-Type: application/json' --data-binary '{"type":"note", "title": "Shell", "body": "'"$1"'"}' > /dev/null 2>&1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os, inspect | |
| class Push: | |
| """A simple wrapper around Pushbullet""" | |
| def __init__(self, key): | |
| self.key = key | |
| self.title = inspect.stack()[1][1] | |
| def post(self, msg, title=None): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (function(){ | |
| // hide friend activities | |
| document.getElementById('pagelet_ticker').style.display = 'None'; | |
| // hides games of friends/ recommended games | |
| document.getElementById('pagelet_canvas_nav_content').style.display = 'None'; | |
| // reposition on the main content area | |
| document.getElementById('contentArea').style.paddingLeft = '100px'; | |
| // hide game requests/friend request column | |
| document.getElementById('rightCol').style.display = 'None'; | |
| })(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/python | |
| import sleekxmpp | |
| import logging | |
| from chatterbotapi import ChatterBotFactory, ChatterBotType | |
| factory = ChatterBotFactory() | |
| bot1 = factory.create(ChatterBotType.CLEVERBOT) | |
| bot1session = bot1.create_session() | |
| logging.basicConfig(level=logging.DEBUG) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import urllib2, sys, os | |
| text = str(sys.argv[1]).replace(' ', '%20') | |
| url = "http://translate.google.com/translate_tts?tl=en&q=" + text | |
| request = urllib2.Request(url) | |
| request.add_header('User-agent', 'Mozilla/5.0') | |
| opener = urllib2.build_opener() | |
| f = open("/tmp/data.mp3", "wb") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from SimpleCV import Camera, Display, Color | |
| ON_CIRCLE = False | |
| def parm_on_obj(a, b, r, obj): | |
| global ON_CIRCLE | |
| x = [a - r, a + r] | |
| y = [b - r, b + r] | |
| if (x[0] < obj.x < x[1]) and (y[0] < obj.y < y[1]): | |
| ON_CIRCLE = True |
NewerOlder