This file contains 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 | |
import pickle | |
import warnings | |
import numpy as np | |
import pandas as pd | |
from sklearn.model_selection import train_test_split | |
from tensorflow.keras.callbacks import EarlyStopping | |
from tensorflow.keras.layers import Dense | |
from tensorflow.keras.layers import Dropout |
This file contains 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
struct group_info init_groups = { .usage = ATOMIC_INIT(2) }; | |
struct group_info *groups_alloc(int gidsetsize){ | |
struct group_info *group_info; | |
int nblocks; |
This file contains 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 hash_file(file, block_size=65536): | |
hasher = hashlib.md5() | |
for buf in iter(partial(file.read, block_size), b''): | |
hasher.update(buf) | |
return hasher.hexdigest() | |
def upload_to(instance, filename): | |
""" |
This file contains 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/env bash | |
pkgver=1.2.21 | |
mkdir -p $VIRTUAL_ENV/src && cd $VIRTUAL_ENV/src | |
curl -O http://oligarchy.co.uk/xapian/$pkgver/xapian-core-$pkgver.tar.xz && tar xf xapian-core-$pkgver.tar.xz | |
curl -O http://oligarchy.co.uk/xapian/$pkgver/xapian-bindings-$pkgver.tar.xz && tar xf xapian-bindings-$pkgver.tar.xz | |
cd $VIRTUAL_ENV/src/xapian-core-$pkgver |
This file contains 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
sudo apt-get update | |
sudo apt-get upgrade | |
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10 | |
sudo echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | sudo tee /etc/apt/sources.list.d/10gen.list | |
sudo sudo apt-get -y update | |
sudo apt-get -y install mongodb-10gen | |
# Start mongodb on startup | |
sudo update-rc.d mongodb defaults |
This file contains 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
# OLD One with error => 'You cannot call create unless the parent is saved' | |
def number_list=(numbers_string) | |
self.numbers.destroy_all | |
numbers = numbers_string.split(",").collect{|num| num.strip.downcase}.uniq | |
numbers.each do |number| | |
num = self.numbers.find_or_create_by_content(number) | |
end | |
end |
This file contains 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
# Improved one base on condition, bad coding but it's work! | |
def number_list=(numbers_string) | |
self.numbers.destroy_all | |
numbers = numbers_string.split(",").collect{|num| num.strip.downcase}.uniq | |
numbers.each do |number| | |
unless !self.save | |
num = self.numbers.find_or_create_by_content(number) | |
end | |
end | |
end |
This file contains 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
ActiveRecord::Schema.define(:version => 20110221190024) do | |
create_table "comments", :force => true do |t| | |
t.string "title" | |
t.text "body" | |
t.integer "commentable_id" | |
t.string "commentable_type" | |
t.datetime "created_at" | |
t.datetime "updated_at" | |
end |
This file contains 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
class UsersController < ApplicationController | |
before_filter :authenticate, :except => [:show, :new, :create] | |
before_filter :correct_user, :only => [:edit, :update] | |
before_filter :admin_user, :only => :destroy | |
def index | |
@title = "All users" | |
@users = User.paginate(:page => params[:page]) | |
end | |
This file contains 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
#include <QApplication> | |
#include <QLabel> | |
int main(int argc, char **argv) | |
{ | |
QApplication App(argc, argv); | |
QLabel Lbl("Hello KhoshGel!"); | |
Lbl.show(); | |
App.exec(); | |
} |
NewerOlder