Skip to content

Instantly share code, notes, and snippets.

@ManUtopiK
ManUtopiK / clean-graphql.js
Last active May 5, 2024 20:11
Clean graphql response : Remove edges, node and __typename from graphql response
/**
* Remove edges, node and __typename from graphql response
*
* @param {Object} input - The graphql response
* @returns {Object} Clean graphql response
*/
const cleanGraphQLResponse = function(input) {
if (!input) return null
const output = {}
const isObject = obj => {
@mbn18
mbn18 / gist:0d6ff5cb217c36419661
Last active October 21, 2023 10:22
How to install nsenter on Ubuntu 14.04
# Ubuntu 14.04 don't have nsenter - the straight forward way required me to install build tools and etc.
# I preferred to keep the system clean and install nsenter in a container and then copy the command to the host
# Note - its also possible to run nsenter from a container (didn't tried) https://github.com/jpetazzo/nsenter
# start a container
docker run --name nsenter -it ubuntu:14.04 bash
## in the docker
apt-get update
apt-get install git build-essential libncurses5-dev libslang2-dev gettext zlib1g-dev libselinux1-dev debhelper lsb-release pkg-config po-debconf autoconf automake autopoint libtool
@adamlj
adamlj / send_mailgun_attachments.py
Created January 23, 2014 10:53
MailGun API Python Requests multiple Attachments Send mail with multiple files/attachments with custom file names
requests.post("https://api.mailgun.net/v2/DOMAIN/messages",
auth=("api", "key-SECRET"),
files={
"attachment[0]": ("FileName1.ext", open(FILE_PATH_1, 'rb')),
"attachment[1]": ("FileName2.ext", open(FILE_PATH_2, 'rb'))
},
data={"from": "FROM_EMAIL",
"to": [TO_EMAIL],
"subject": SUBJECT,
"html": HTML_CONTENT
@thurloat
thurloat / cherokee_uwsgi_install.sh
Created May 18, 2011 22:41
Installing Cherokee and uWSGI on a standard EC2 box
# Install dev tools for cherokee installation
sudo yum groupinstall "Development Tools"
sudo wget http://cherokee-project.com/install && sudo python install
# Install a bunch of def packages for uwsgi install correctly
sudo yum install python python-devel libxml2 libxml2-devel python-setuptools zlib-devel wget openssl-devel pcre pcre-devel sudo gcc make autoconf automake
# Install UWSGI to /opt/uwsgi/uwsgi
cd /opt/
sudo wget http://projects.unbit.it/downloads/uwsgi-0.9.6.5.tar.gz