Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
Working Smart

ibrahim ethem demirci iedmrc

💭
Working Smart
View GitHub Profile
@iedmrc
iedmrc / update-docker-images.sh
Created Sep 11, 2020
To update docker images that only have the 'latest' tag:
View update-docker-images.sh
docker images --format "{{.Repository}}:{{.Tag}}" | grep :latest | xargs -L1 docker pull
@iedmrc
iedmrc / async.py
Last active Aug 21, 2020 — forked from phizaz/async.py
Python turn sync functions to async (and async to sync)
View async.py
import functools
import asyncio
from concurrent.futures import ThreadPoolExecutor
def to_async(func):
"""Turns a sync function to async function using event loop"""
@functools.wraps(func)
async def run(*args, loop=None, executor=None, **kwargs):
if loop is None:
@iedmrc
iedmrc / connect_psycopg2_to_pandas.py
Created Jul 23, 2020 — forked from jakebrinkmann/connect_psycopg2_to_pandas.py
Read SQL query from psycopg2 into pandas dataframe
View connect_psycopg2_to_pandas.py
import pandas as pd
import pandas.io.sql as sqlio
import psycopg2
conn = psycopg2.connect("host='{}' port={} dbname='{}' user={} password={}".format(host, port, dbname, username, pwd))
sql = "select count(*) from table;"
dat = sqlio.read_sql_query(sql, conn)
conn = None
@iedmrc
iedmrc / docker-compose.yml
Last active Feb 12, 2020
Docker-compose file for Project Galois. Check out: https://github.com/iedmrc/galois-autocompleter
View docker-compose.yml
version: '2.3'
services:
autocompleter:
container_name: autocompleter
image: iedmrc/galois-autocompleter:latest-gpu
restart: always
expose:
- "3030"
runtime: nvidia
networks:
View docker-compose.yml
version: "3"
services:
osrm:
container_name: osrm
image: osrm/osrm-backend
restart: always
ports:
- "5000:5000"
volumes:
- ./osrm:/data
@iedmrc
iedmrc / FlowController.php
Created Jul 13, 2018
A code snippet from a laravel project I wrote
View FlowController.php
/**
* Saves post to database
* @param Request $request
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
*/
public function post(Request $request)
{
//Models
$posts = new Post();
$hashtags = new Hashtag();
@iedmrc
iedmrc / c101
Last active Oct 12, 2017
ck101
View c101
https://en.wikipedia.org/wiki/C_(programming_language)
https://tr.wikipedia.org/wiki/UNIX
https://en.wikipedia.org/wiki/BCPL
https://www.levenez.com/unix/unix.png
https://en.wikipedia.org/wiki/X86_instruction_listings
https://en.wikipedia.org/wiki/List_of_instruction_sets
https://en.wikipedia.org/wiki/History_of_programming_languages
https://www.computerhope.com/issues/ch000984.htm
https://en.wikipedia.org/wiki/Timeline_of_programming_languages
https://en.wikipedia.org/wiki/Plankalkül
@iedmrc
iedmrc / bladeCompiler.php
Created Aug 16, 2017
Compile blade template string to (bare) php
View bladeCompiler.php
/**
* Compile blade template string to (bare) php
* @param $value
* @param array $args
* @return string
* @throws \Exception
*/
public static function bladeCompile($value, array $args = array())
{
$generated = \Blade::compileString($value);
View preg.php
//$message herhangi bir string olmak uzere hashtagler, mentionlar,youtube linkleri ve normal linkler icin preg.
$parsedMessage =
preg_replace_callback_array(
[
'/(?i)\b((?:https?:\/\/|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:\'".,<>?«»“”‘’]))/'
=>function ($m) {
$matches=[];
$match_bool=preg_match('/\s*[a-zA-Z\/\/:\.]*youtu(be.com\/watch\?v=|.be\/)([a-zA-Z0-9\-_]+)([a-zA-Z0-9\/\*\-\_\?\&\;\%\=\.]*)/i',$m[0],$matches);
if($match_bool)
{
@iedmrc
iedmrc / tkinter_giris.py
Created Dec 14, 2015
Python Tkinter ile ufak bir oyun
View tkinter_giris.py
#--coding:cp1254
#kutuphaneler
from Tkinter import *
import tkMessageBox
import random
import tkFont
#global degiskenler
Aoyuncusu=""