Skip to content

Instantly share code, notes, and snippets.

Avatar

Ramazan Polat ramazanpolat

View GitHub Profile
@ramazanpolat
ramazanpolat / .bashrc
Last active Jul 30, 2020
Colored bash prompt. When exitcode OK it is happy :) Otherwise it is sad :(
View .bashrc
export PS1='\[\e[33m\]\u@\h:\w\[\e[0m\] $(if [[ $? == 0 ]]; then echo "\[$(tput setaf 2)\]:) "; else echo "\[\e[31m\]:( "; fi)\[$(tput sgr0)\]'
View serdes.java
package com.rambo;
import com.arangodb.ArangoDBException;
import com.arangodb.entity.BaseDocument;
import com.arangodb.entity.CollectionEntity;
import com.arangodb.velocypack.VPack;
import com.arangodb.velocypack.VPackSlice;
import org.msgpack.MessagePack;
import com.arangodb.ArangoDB;
@ramazanpolat
ramazanpolat / bg_extract.py
Created Jun 30, 2019
background extraction with opencv
View bg_extract.py
import cv2
import copy
class Copyable:
__slots__ = 'a', '__dict__'
def __init__(self, a, b):
self.a, self.b = a, b
@ramazanpolat
ramazanpolat / postgres-01
Last active Jun 10, 2019
Command for first time PostgreSQL 11 users
View postgres-01
### installation
### connection
su - postgres
psql
#### psql commands
# connect to a database
\connect dbname
@ramazanpolat
ramazanpolat / build_install_python3.6.7.sh
Last active Oct 27, 2018
Build and install python 3.6.7 from source on Ubuntu 16.04 LTS(Xenial). Includes SSL/TLS for pip.
View build_install_python3.6.7.sh
apt install build-essential -y
apt install zlib1g-dev -y
apt install libssl-dev libncurses5-dev libsqlite3-dev libreadline-dev libtk8.5 libgdm-dev libdb4o-cil-dev libpcap-dev -y
apt update
apt upgrade
git clone https://github.com/deadsnakes/python3.6
cd python3.6
./configure --enable-optimizations
# make command will take 10 mins
make
View apistar_multipart.py
import os
from typing import Any
from apistar import App, Route, http
from apistar.codecs.multipart import MultiPartCodec
from werkzeug.datastructures import FileStorage
UPLOAD_FOLDER = os.path.join('.', 'uploads')
PORT = 8080
View coin_info.py
__coin_info = {
'1ST': {'name': 'FirstBlood', 'status': 'black', 'category': []},
'420G': {'name': 'GanjaCoin', 'status': 'black', 'category': ['drug']},
'4CHN': {'name': 'ChanCoin', 'status': 'black', 'category': ['gambling']},
'2GIVE': {'name': '2GIVE', 'status': 'black', 'category': ['riba']},
'ABY': {'name': 'ArtByte', 'status': 'white', 'category': []},
'ADA': {'name': 'Cardano', 'status': 'white', 'category': []},
'ADT': {'name': 'adToken', 'status': 'white', 'category': []},
'ADX': {'name': 'AdEx', 'status': 'white', 'category': []},
'AEON': {'name': 'Aeon', 'status': 'white', 'category': []},
View webpack.config.js
var debug = process.env.NODE_ENV !== "production";
var webpack = require('webpack');
module.exports = {
context: __dirname,
devtool: debug ? "inline-sourcemap" : null,
entry: "./js/scripts.js",
output: {
path: __dirname + "/js",
filename: "scripts.min.js"
View designer.html
<link rel="import" href="../topeka-elements/category-images.html">
<link rel="import" href="../core-icon/core-icon.html">
<link rel="import" href="../core-icons/core-icons.html">
<link rel="import" href="../core-icons/av-icons.html">
<link rel="import" href="../paper-fab/paper-fab.html">
<link rel="import" href="../topeka-elements/category-icons.html">
<polymer-element name="my-element">
<template>
View MoTools.cs
public class MoUtils
{
private static readonly Random random = new Random();
public DataTable MergeDataTable(DataTable dt1, DataTable dt2)
{
DataTable dtMerged = new DataTable();
foreach (DataColumn dc in dt1.Columns)
{
dtMerged.Columns.Add(dc.ColumnName, dc.DataType);
You can’t perform that action at this time.