Skip to content

Instantly share code, notes, and snippets.

View tarekbadrsh's full-sized avatar
🎯
Focusing

Tarek Badr tarekbadrsh

🎯
Focusing
View GitHub Profile
@tarekbadrsh
tarekbadrsh / collect_all_files.py
Last active July 26, 2024 07:09
Multi-File Commenter and Combiner
import os
import fnmatch
def get_comment_prefix(filename):
extension_to_comment = {
'.asm': (';', ';'),
'.awk': ('#', '#'),
'.c': ('//', '//'),
'.clj': (';;', ';;'),
'.cpp': ('//', '//'),
@tarekbadrsh
tarekbadrsh / combine_text_files.py
Created April 20, 2023 18:48
This script combines all text files in a specified directory and writes their contents to a single text file, with an option to also create a PDF file.
"""
Combine Text Files Script
This script combines all text files in a specified directory and writes their contents to a single text file,
with an option to also create a PDF file.
How to use:
1. Ensure you have the `reportlab` library installed. If not, install it with the following command:
pip install reportlab
@tarekbadrsh
tarekbadrsh / mergeTwLists.go
Last active July 4, 2021 19:19
Merge two Twitter lists using twitter-api
package main
import (
"fmt"
"net/url"
"github.com/tarekbadrshalaan/anaconda"
)
func main() {
@tarekbadrsh
tarekbadrsh / valgrind_memory_test.md
Created March 14, 2020 09:02
how to use valgrind

REF.Stack-Overflow

C code main.c

#include <stdlib.h>

int main() {
    char* string = malloc(5 * sizeof(char)); //LEAK: not freed!
@tarekbadrsh
tarekbadrsh / go_context.go
Last active February 28, 2020 20:09
go context example
// ref: http://p.agnihotry.com/post/understanding_the_context_package_in_golang
// ref: https://github.com/pagnihotry/golang_samples/blob/master/go_context_sample.go
// ref: https://play.golang.org/p/grQAUN3MBlg
// ref: https://play.golang.org/p/NQBpTvigNUA
package main
import (
"context"
"fmt"
"math/rand"
@tarekbadrsh
tarekbadrsh / Use_go-ipfs-http-client.go
Created June 1, 2019 10:35
this Gist about using new ipfs http client (go-ipfs-http-client)
package main
import (
"context"
"fmt"
httpapi "github.com/ipfs/go-ipfs-http-client"
path "github.com/ipfs/interface-go-ipfs-core/path"
)
@tarekbadrsh
tarekbadrsh / Hello_World.py
Created July 17, 2018 20:59
how to print hello world in python
print("Hello World")