Skip to content

Instantly share code, notes, and snippets.

View gokberkakdeniz's full-sized avatar
💭
nothing.

Gökberk Akdeniz gokberkakdeniz

💭
nothing.
View GitHub Profile
@gokberkakdeniz
gokberkakdeniz / itertools.py
Created April 3, 2022 15:32
itertools extensions
from itertools import tee
def triplewise(iterable):
"""triplewise('ABCDEFG') --> ABC BCD CDE DEF EFG"""
a, b, c = tee(iterable, 3)
next(b, None)
next(c, None)
next(c, None)
return zip(a, b, c)
#!/usr/bin/env python3
# Author: Gokberk Akdeniz
import math
def f(x):
#fonksiyonu gir buraya
return x * (math.cos(x))
@gokberkakdeniz
gokberkakdeniz / mv.md5.sh
Created January 15, 2021 20:08
Renames files with their md5 hash
#!/bin/sh
HELP="Usage: mv.md5 [OPTION] SOURCE
Rename SOURCE to md5 hash of itself.
-R, --recursive rename all files in the given folder
-h, --help show help"
function mv_md5() {
dest=`dirname "$1"`/`md5sum "$1" | cut -d" " -f1`."${1##*.}"
@gokberkakdeniz
gokberkakdeniz / screenctl.sh
Created December 20, 2020 15:28
screenctl: control temperature/brightness of your monitor using xrandr/ddcutil
#!/bin/env bash
# Copyright (c) 2020 Gökberk Akdeniz
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#include <stdio.h>
int main() {
//if your input is negative number, it will show input+2^32
unsigned int number; // max value: 2^32
int i;
printf("Enter a number: ");
scanf("%d", &number);
for(i = 31; i >= 0; i--) {
if ((1 << i) > number) { //put 0 until number < 2^i
from os import system
import re
board = [["-", "-", "-"],
["-", "-", "-"],
["-", "-", "-"]]
move = ""
moves = 0
@gokberkakdeniz
gokberkakdeniz / center_active_window.py
Last active November 11, 2017 18:26
Script for aligning the center of # user's active window with the center of the monitor
#!/usr/bin/env python3
# Author: Gokberk AKDENIZ
# Date: 11.11.2017
# Description: Script for aligning the center of
# user's active window with the center of the monitor
# Tested on: Debian 9.2 stretch
# Original: https://gist.github.com/SergKolo/328548cc3c2b4597d7f7ab91db26709d