Skip to content

Instantly share code, notes, and snippets.

View kerolloz's full-sized avatar

Kerollos Magdy kerolloz

View GitHub Profile
#include <iostream>
using namespace std;
struct tnode{
unsigned int data;
tnode *left = NULL;
tnode *right = NULL;
};
tnode* create_tnode(unsigned int x){
#include <bits/stdc++.h>
using namespace std;
int main (){
int t; cin >> t;
for(int i =0; i < t; i++){
int n, x, y;
cin >> n >> x >> y;
int arr[n];
#include <bits/stdc++.h>
using namespace std;
int main (){
int n;cin >> n;
for (int i = 0; i < n; ++i) {
int t;
cin >> t;
#include <bits/stdc++.h>
using namespace std;
int main (){
int n;cin >> n;
for (int i = 0; i < n; ++i) {
string s;
@kerolloz
kerolloz / file_renamer.py
Created December 9, 2018 20:24
change filenames from .html to .php in current directory
import os
def rename_html_to_php():
for filename in os.listdir("."):
if os.path.isdir(filename):
os.chdir("./"+filename)
rename_html_to_php()
os.chdir("..")
if filename.endswith(".html"):
@kerolloz
kerolloz / file_remover.py
Created December 9, 2018 22:26
remove files in current directory recursively (including inner directories)
import os
def remove_files_in_dir(deleted_filename):
for filename in os.listdir("."):
if os.path.isdir(filename):
os.chdir("./"+filename)
remove_files_in_dir(deleted_filename)
os.chdir("..")
if filename.endswith(deleted_filename):
@kerolloz
kerolloz / change.py
Last active December 24, 2018 22:29
change all style.css and script.js sources
import os
from os import remove
def replace(file_path, pattern, subst):
# Create temp file
for filename in os.listdir("."):
if os.path.isdir(filename):
os.chdir("./" + filename)
replace(file_path, pattern, subst)
@kerolloz
kerolloz / convert.cpp
Created December 31, 2018 14:19
convert function
#include <iostream>
using namespace std;
struct tree_node{
unsigned int data;
tree_node *left = NULL;
tree_node *right = NULL;
};
struct list_node{
"""
This script extracts nested files from their folders to the outter folder
say in the current dir we have the following folders:
f1
f2
f3
each one has folders inside of it and those folders have files inside of them
this script will get those files from the nested folders to the outer level
"""
import os
@kerolloz
kerolloz / _config.yml
Created March 29, 2019 11:01
github.io
layout: stacked
style: light
plugins:
- jekyll-octicons
- jekyll-github-metadata
- jemoji
permalink: /:year/:month/:day/:title/