Skip to content

Instantly share code, notes, and snippets.

View HeshamMeneisi's full-sized avatar
🏠
Working from home

Hesham Meneisi HeshamMeneisi

🏠
Working from home
View GitHub Profile
using (WebClient client = new WebClient())
{
client.Headers = new WebHeaderCollection{{"x-access-token", "..."}};
await using (Stream stream = client.OpenRead("http://...dump.json"))
using (StreamReader streamReader = new StreamReader(stream ?? throw new NullJsonDumpException()))
using (JsonTextReader reader = new JsonTextReader(streamReader))
{
reader.SupportMultipleContent = true;
var serializer = new JsonSerializer();
@HeshamMeneisi
HeshamMeneisi / docker-compose
Last active September 13, 2023 21:47
Mount S3 as Docker Volume (docker-compose)
# Tip: You can just define all environment variables used here in a
# .env file in the same directory so as not to expose secrets
# docker-compose will load it automatically
services:
s3fs:
privileged: true
image: efrecon/s3fs:1.86
restart: always
environment:
- AWS_S3_BUCKET=${AWS_S3_BUCKET}
docker run --network=host --rm -v ${PWD}:/local openapitools/openapi-generator-cli generate -i http://localhost:5000/swagger/v1/swagger.json -g {LANGUAGE} -o /local/sdks/{LANGUAGE}
//npm.pkg.github.com/:_authToken={TOKEN}
@{company}:registry=https://npm.pkg.github.com
google-chrome --user-data-dir=”/var/tmp/Chrome” --disable-web-security &
#!/bin/bash
usage() {
cat << EOF
Usage: $0 [OPTION]
Build frontend.
Arguments:
-d Dev-mode (This will skip any production-specific operations)
-s Push stable to docker.io, ignored in dev-mode. (auto-set by "feat:*" commit)
-b Build image (auto-set after a new commit)
@HeshamMeneisi
HeshamMeneisi / accdb2csv.py
Created October 26, 2019 21:46
ACCDB to CSV on non-Windows system (Without MS Access parser)
#!/usr/bin/env python
# coding: utf-8
# Requirements
# sudo apt install mdbtools
import os
import subprocess
@HeshamMeneisi
HeshamMeneisi / Productivity
Last active March 19, 2020 05:14
Useful bash paths, aliases and functions
# START_0f56bb1d
# To Install permanently:
# curl -s https://gist.githubusercontent.com/HeshamMeneisi/0f56bb1dfd3ca3d09d304d3a02107205/raw/Productivity >> ~/.bashrc && source ~/.bashrc
# To Uninstall:
# cp ~/.bashrc bashrc.bak && perl -0777 -i -pe "s/# START_0f56bb1d.+# END_0f56bb1d//igs" ~/.bashrc
# To use temporarily:
# source <(curl -s https://gist.githubusercontent.com/HeshamMeneisi/0f56bb1dfd3ca3d09d304d3a02107205/raw/Productivity)
# Useful paths
# !! MAKE SURE TO UPDATE VERSION NUMBERS !!
export PATH=/home/$USER/.dotnet:/usr/local/cuda-9.0/bin:~/browser-drivers:~/.composer/vendor/bin${PATH:+:${PATH}}
# http://blog.jessitron.com/2013/08/finding-and-removing-large-files-in-git.html
git rev-list master | while read rev; do git ls-tree -lr $rev | cut -c54- | grep -v '^ '; done | sort -u | perl -e '
while (<>) {
chomp;
@stuff=split("\t");
$sums{$stuff[1]} += $stuff[0];
}
print "$sums{$_} $_\n" for (keys %sums);
' | sort -rn >> /tmp/large_files
gedit /tmp/large_files
@HeshamMeneisi
HeshamMeneisi / CSV Encoder and Decoder C#
Last active June 2, 2018 22:09
CSV Encoding/Decoding from/to C# IEnumerable
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace CSV