Skip to content

Instantly share code, notes, and snippets.

View iedmrc's full-sized avatar
💭
Working Smart

ibrahim ethem demirci iedmrc

💭
Working Smart
View GitHub Profile
@iedmrc
iedmrc / update-docker-images.sh
Created September 11, 2020 09:01
To update docker images that only have the 'latest' tag:
docker images --format "{{.Repository}}:{{.Tag}}" | grep :latest | xargs -L1 docker pull
@iedmrc
iedmrc / async.py
Last active May 15, 2024 14:28 — forked from phizaz/async.py
Python turn sync functions to async (and async to sync)
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 July 23, 2020 10:11 — forked from jakebrinkmann/connect_psycopg2_to_pandas.py
Read SQL query from psycopg2 into pandas dataframe
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 February 12, 2020 20:16
Docker-compose file for Project Galois. Check out: https://github.com/iedmrc/galois-autocompleter
version: '2.3'
services:
autocompleter:
container_name: autocompleter
image: iedmrc/galois-autocompleter:latest-gpu
restart: always
expose:
- "3030"
runtime: nvidia
networks:
@iedmrc
iedmrc / docker-compose.yml
Last active July 30, 2024 05:47
docker-compose file for the "VROOM with OSRM backend" stack. https://dev.to/iedmrc/vehicle-routing-problems-and-how-to-solve-them-8h3
version: "3"
services:
osrm:
container_name: osrm
image: osrm/osrm-backend
restart: always
ports:
- "5000:5000"
volumes:
- ./osrm:/data
@iedmrc
iedmrc / FlowController.php
Created July 13, 2018 17:03
A code snippet from a laravel project I wrote
/**
* 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 October 12, 2017 08:03
ck101
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 August 16, 2017 07:46
Compile blade template string to (bare) 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);
//$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 December 14, 2015 21:19
Python Tkinter ile ufak bir oyun
#--coding:cp1254
#kutuphaneler
from Tkinter import *
import tkMessageBox
import random
import tkFont
#global degiskenler
Aoyuncusu=""