Skip to content

Instantly share code, notes, and snippets.

View mahmoud-samy's full-sized avatar

Mahmoud Samy mahmoud-samy

View GitHub Profile
@BretFisher
BretFisher / docker-for-mac.md
Last active September 18, 2024 18:51
Getting a Shell in the Docker Desktop Mac VM

2021 Update: Easiest option is Justin's repo and image

Just run this from your Mac terminal and it'll drop you in a container with full permissions on the Docker VM. This also works for Docker for Windows for getting in Moby Linux VM (doesn't work for Windows Containers).

docker run -it --rm --privileged --pid=host justincormack/nsenter1

more info: https://github.com/justincormack/nsenter1


@plukevdh
plukevdh / objectDiff.js
Last active April 11, 2022 13:56
Ramda - Compact diff output for complex objects.
import R from 'ramda'
const isObject = R.compose(R.equals('Object'), R.type);
const allAreObjects = R.compose(R.all(isObject), R.values);
const hasLeft = R.has('left');
const hasRight = R.has('right');
const hasBoth = R.both(hasLeft, hasRight);
const isEqual = R.both(hasBoth, R.compose(R.apply(R.equals), R.values));
const markAdded = R.compose(R.append(undefined), R.values);
@dduvnjak
dduvnjak / add_cloudflare_ips.sh
Last active June 26, 2024 07:47
Add CloudFlare IP addresses to an EC2 Security Group using awscli
# first we download the list of IP ranges from CloudFlare
wget https://www.cloudflare.com/ips-v4
# set the security group ID
SG_ID="sg-00000000000000"
# iterate over the IP ranges in the downloaded file
# and allow access to ports 80 and 443
while read p
do
var express = require('express');
var session = require('express-session');
var RedisStore = require('connect-redis')(session);
var Strategy = require('./passport-openidconnect/index').Strategy;
module.exports.configure = function configure(app, passport) {
var identityServer = 'https://users.xxx.com/identity';
var auth = {
@sandrinodimattia
sandrinodimattia / gist:3493335
Created August 27, 2012 23:27
Output logs in the emulator
public class WebRole : RoleEntryPoint
{
private TraceSource CreateTraceSource()
{
var traceSource = new TraceSource("SampleApp", SourceLevels.All);
traceSource.Listeners.Add(
Activator.CreateInstance(
Type.GetType("Microsoft.ServiceHosting.Tools.DevelopmentFabric.Runtime.DevelopmentFabricTraceListener, Microsoft.ServiceHosting.Tools.DevelopmentFabric.Runtime, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")) as TraceListener);
return traceSource;
}