Skip to content

Instantly share code, notes, and snippets.

View isezen's full-sized avatar
💭
Working at Çay Bahçesi :)

Ismail SEZEN isezen

💭
Working at Çay Bahçesi :)
View GitHub Profile
@isezen
isezen / file.py
Created April 22, 2016 06:51
get path from __file__ or os.getcwd()
import os
if '__file__' in globals():
cdir = os.path.dirname(os.path.realpath(__file__))
else:
cdir = os.getcwd()
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@isezen
isezen / kNN_example.r
Last active May 13, 2017 18:22
kNN Example
library(class)
library(gmodels)
set.seed(6)
df <- data.frame(A = c(rnorm(30, 0), rnorm(30, 3)),
B = c(rnorm(30, 0), rnorm(30, 3)),
Group = factor(c(rep("G1", 30), rep("G2", 30))))
# use 33% of data for training and 67% is for test
i <- sample(2, nrow(df), replace = TRUE, prob = c(0.67, 0.33))
train.df <- df[i == 2, -3] # do not include last column
train.cl <- df[i == 2, 3] # training result cluters
@isezen
isezen / bact2.py
Created November 4, 2017 07:45
1-D Bacterium Example
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# pylint: disable=C0103, C0321, C0330
"""1-D Bacterium class example"""
from random import randint as rnd
import gc
import time
from matplotlib import pyplot as plt
from datetime import datetime as dt
def _split_n(x, n):
y = [x // n for i in range(n)]
for i in range(x % n):
y[i] += 1
return y
Run R:
sudo PKG_CONFIG_PATH="/home/programs/anaconda3/lib/pkgconfig/" LD_LIBRARY_PATH="/home/programs/anaconda3/lib" R
run the command:
remotes::install_github("r-spatial/sf", configure.args = "--with-gdal-config=/home/programs/anaconda3/bin/gdal-config --with-geos-config=/home/programs/anaconda3/bin/geos-config --with-proj-include=/home/programs/anaconda3/include/ --with-proj-lib=/home/programs/anaconda3/lib/")
nrm <- function(x, min = 0, max = 1, range_x = range(x)) {
a <- (max - min)/(max(range_x) - min(range_x))
b <- max - a * max(range_x)
a * x + b
}
panel <- function(x, y, ...) {
ok <- is.finite(x) & is.finite(y)
if (any(ok)) {
xx <- x[ok]; yy <- y[ok]
if (par("xlog")) xx <- log10(xx)
@isezen
isezen / linux-ubuntu-install-wifi-drivers
Created August 28, 2022 18:05 — forked from torresashjian/linux-ubuntu-install-wifi-drivers
How to install Broadcom bcm43602 Drivers on Ubuntu Linux
sudo apt-get purge bcmwl-kernel-source
sudo apt update
sudo update-pciids
sudo apt install firmware-b43-installer
sudo reboot #note that this will restart your computer
sudo iwconfig wlp3s0 txpower 10dBm
#sudo iwconfig wlp2s0 txpower 10dBm
@isezen
isezen / massa.sh
Last active November 2, 2022 10:19
Massa Installation Script
#!/bin/bash
#
# This script contains `sudo` command to download/update required packages and register system service for Massa.
#
# - download, make executable and run script:
# wget -qO massa.sh https://gist.githubusercontent.com/isezen/3e4646cdacc4ea985c3f2bd6f42dbd39/raw/massa.sh && chmod +x massa.sh && ./massa.sh
# - Just type `massa-client` to run.
# - to see the logs, type `see-logs`.
#
echo -e ''