Skip to content

Instantly share code, notes, and snippets.

View alperozaydin's full-sized avatar

Alper Ozaydin alperozaydin

View GitHub Profile
list1 = [102, 306, 918, 2754]
list2 = [1, 3, 9, 27]
averages = []
for idx1, el1 in enumerate(list1): # first for-loop
for idx2, el2 in enumerate(list2): # second for-loop
if idx1 == idx2: # check whether the indexes of first * second for-loop match
y_intercept = el1/el2
averages.append(y_intercept)
>>> averages
from sklearn.feature_extraction.text import TfidfVectorizer, CountVectorizer
from sklearn.decomposition import NMF, LatentDirichletAllocation
import numpy as np
def display_topics(H, W, feature_names, documents, no_top_words, no_top_documents):
for topic_idx, topic in enumerate(H):
print "Topic %d:" % (topic_idx)
print " ".join([feature_names[i]
for i in topic.argsort()[:-no_top_words - 1:-1]])
top_doc_indices = np.argsort( W[:,topic_idx] )[::-1][0:no_top_documents]
@nepsilon
nepsilon / git-change-commit-messages.md
Last active June 2, 2024 23:31
How to change your commit messages in Git? — First published in fullweb.io issue #55

How to change your commit messages in Git?

At some point you’ll find yourself in a situation where you need edit a commit message. That commit might already be pushed or not, be the most recent or burried below 10 other commits, but fear not, git has your back 🙂.

Not pushed + most recent commit:

git commit --amend

This will open your $EDITOR and let you change the message. Continue with your usual git push origin master.

@vasanthk
vasanthk / System Design.md
Last active July 6, 2024 10:13
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@myusuf3
myusuf3 / delete_git_submodule.md
Created November 3, 2014 17:36
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule
@umpirsky
umpirsky / A.markdown
Last active August 3, 2023 18:14 — forked from olivierlacan/An_example.markdown
Sublime Text Monokai Sidebar Theme.
@cpatrick
cpatrick / runsearch.py
Last active October 3, 2021 15:18
Sample Python for running a full-text search using PyMongo
from pymongo import Connection
if __name__ == '__main__':
# Connect to mongo
conn = Connection()
db = conn['canepi']
# Set the search term
term = 'foo'
@jtatum
jtatum / atomac_skype.py
Last active May 21, 2019 19:59
Use ATOMac to click various items in the menubar menu for Skype
import atomac
a=atomac.getAppRefByLocalizedName('Skype')
cloud_menu = a.AXChildren[2].AXChildren[0]
print cloud_menu
# Some apps are coded so menu items aren't populated until they're displayed
try:
cloud_menu.Press()
except atomac.ErrorCannotComplete:
# An accessibility bug you'll see sometimes - the app never reports
@darktable
darktable / SavWav.cs
Created April 6, 2012 05:01
Unity3D: script to save an AudioClip as a .wav file.
// Copyright (c) 2012 Calvin Rien
// http://the.darktable.com
//
// This software is provided 'as-is', without any express or implied warranty. In
// no event will the authors be held liable for any damages arising from the use
// of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it freely,
// subject to the following restrictions: