Skip to content

Instantly share code, notes, and snippets.

View ozlerhakan's full-sized avatar

Hakan Özler ozlerhakan

View GitHub Profile
@Coldsp33d
Coldsp33d / iter_vs_vec_benchmark.py
Last active June 6, 2024 10:26
Comparing iteration and vectorisation with a simple example
import perfplot
import pandas as pd
def vec(df):
return df['A'] + df['B']
def vec_numpy(df):
return df['A'].to_numpy() + df['B'].to_numpy()
def list_comp(df):
@jonjack
jonjack / add-update-refresh-github-access-token-on-mac.md
Last active July 3, 2024 18:13
Adding & Updating GitHub Access Token on Mac

Using an Access Token for the first time

Follow the instructions on Github to Create an Access Token in Github

Configure Git to use the osxkeychain

By default, git credentials are not cached so you need to tell Git if you want to avoid having to provide them each time Github requires you to authenticate. On Mac, Git comes with an “osxkeychain” mode, which caches credentials in the secure keychain that’s attached to your system account.

You can tell Git you want to store credentials in the osxkeychain by running the following:-

import nltk
from nltk.corpus import stopwords
from nltk.stem import RSLPStemmer
from nltk.stem.wordnet import WordNetLemmatizer
# Download list
!wget https://github.com/michmech/lemmatization-lists/raw/master/lemmatization-pt.txt -q
nltk.download('stopwords')
nltk.download('rslp')
@gokselpirnal
gokselpirnal / gang.js
Last active April 27, 2020 18:30
thecrims-bot
var getRobberies = function(done){
console.log('%c Soygun seçiliyor.','background: black; color: white')
$.ajax({
type: "GET",
url: 'https://www.thecrims.com/api/v1/robberies',
success: function(res){
done(res.single_robberies
.filter(robbery => robbery.successprobability == 100)
.sort((a, b) => b.difficulty - a.difficulty)
.find((x, index) => index == 0))
@wassname
wassname / jupyter_logging.py
Last active November 11, 2022 10:11
simple logging for jupyter or python which outputs to stdout (or a console or terminal) and a log file
"""
In jupyter notebook simple logging to console
"""
import logging
import sys
logging.basicConfig(stream=sys.stdout, level=logging.INFO)
# Test
logger = logging.getLogger('LOGGER_NAME')
@rdinse
rdinse / Google_Colaboratory_backup.py
Created March 13, 2018 22:55
Simple Google Drive backup script with automatic authentication for Google Colaboratory (Python 3)
# Simple Google Drive backup script with automatic authentication
# for Google Colaboratory (Python 3)
# Instructions:
# 1. Run this cell and authenticate via the link and text box.
# 2. Copy the JSON output below this cell into the `mycreds_file_contents`
# variable. Authentication will occur automatically from now on.
# 3. Create a new folder in Google Drive and copy the ID of this folder
# from the URL bar to the `folder_id` variable.
# 4. Specify the directory to be backed up in `dir_to_backup`.
from tpot import TPOTClassifier
from sklearn.cross_validation import train_test_split
from sklearn.datasets import load_iris
import time
# Load and split the data
iris = load_iris()
X_train, X_test, y_train, y_test = train_test_split(iris.data, iris.target, test_size=0.2, random_state=42)
# Construct and fit TPOT classifier
@mskoroglu
mskoroglu / Dockerfile
Created October 26, 2017 08:52
Dockerfile | Timezone
RUN tz=Europe/Istanbul && cp -vf /usr/share/zoneinfo/$tz /etc/localtime && echo $tz | tee /etc/timezone
@jganzabal
jganzabal / Nvidia Titan XP + MacBook Pro + Akitio Node + Tensorflow + Keras.md
Last active November 2, 2022 11:43
How to setup Nvidia Titan XP for deep learning on a MacBook Pro with Akitio Node + Tensorflow + Keras