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 base64 | |
file_data = base64.urlsafe_b64decode(pdf.encode('utf8')) | |
with open('pdf_name.pdf', 'wb') as file: | |
file.write(file_data) | |
return pdf |
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 class_a(object): | |
def speak(self): | |
print("class_a sinifindan cagirildi") | |
class class_b(class_a, object): | |
def speak(self): | |
print("class_b sinifindan cagirildi") | |
super(class_b, self).speak() | |
class class_c(class_a, object): |
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 Point: | |
def __init__(self, x, y): | |
self.x = x | |
self.y = y | |
def __call__(self, x, y): | |
self.x = x | |
self.y = y | |
point = Point(5, 1) |
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
brew install postgresql | |
brew tap homebrew/services | |
brew services start postgresql | |
brew services list |
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
git config gitflow.feature.finish.no-ff true |
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 | |
# kill all connections to the postgres server | |
if [ -n "$1" ] ; then | |
where="where pg_stat_activity.datname = '$1'" | |
echo "killing all connections to database '$1'" | |
else | |
where="where pg_stat_activity.datname in (select datname from pg_database where datname != 'postgres')" | |
echo "killing all connections to database" | |
fi |
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 addition(x): | |
return x + 5 | |
def subtraction(y): | |
return y - 1 | |
def compose(*funcs): | |
return lambda x: reduce(lambda v, f: f(v), reversed(funcs), x) | |
c = compose(addition, subtraction) |
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 Lightning: | |
lights_on = 'ON' | |
lights_off = 'OFF' | |
def button_action(action_type): | |
def action_decorator(func): | |
def action_wrapper(self): | |
if action_type == 'on': | |
print(self.lights_on) | |
func(self) |
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 quicksort(a, p, r): | |
if p < r: | |
q = partition(a, p, r) | |
quicksort(a, p, q - 1) | |
quicksort(a, q + 1, r) | |
def partition(a, p, r): | |
x = a[r] | |
i = p - 1 |
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
public class Garson implements Runnable { | |
public Kantin k; | |
public int id, bekleme; | |
Garson(int id, int bekleme, Kantin k) { | |
this.id = id; | |
this.k = k; | |
this.bekleme = bekleme; | |
} |