Skip to content

Instantly share code, notes, and snippets.

@keepitsimple
keepitsimple / update_node.sh
Created July 27, 2015 21:58
Use npm in order to upgrade node
#Use npm in order to upgrade node
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
@keepitsimple
keepitsimple / gist:6ba1dcea68b14911e557
Created January 12, 2016 10:58
Remove execute perm for php files recursively
find . -type f -print0 -name "*.php" | xargs -0 chmod -x
@keepitsimple
keepitsimple / Dockerfile
Created March 23, 2016 15:26
Docker: Firefox over VNC
# Firefox over VNC
#
# VERSION 0.3
FROM ubuntu
# Install vnc, xvfb in order to create a 'fake' display and firefox
RUN apt-get update && apt-get install -y x11vnc xvfb firefox
RUN mkdir ~/.vnc
# Setup a password
XDEBUG_CONFIG="idekey=PHPSTORM" PHP_IDE_CONFIG="serverName=server_name" php -dxdebug.remote_host=`echo $SSH_CLIENT | cut -d "=" -f 2 | awk '{print $1}'` myscript.php
Option "RegistryDwords" "PowerMizerEnable=0x1; PerfLevelSrc=0x2222; PowerMizerLevel=0x3; PowerMizerDefault=0x3; PowerMizerDefaultAC=0x3"
@keepitsimple
keepitsimple / resize.sh
Created January 11, 2017 14:12 — forked from mifix/resize.sh
LXD - ZFS - resize
# make sure zfs autoexpand is enabled (only needed once)
sudo zpool set autoexpand=on lxd
sudo truncate -s 50G /var/lib/lxd/zfs.img
# Make zfs realize the fact that partition has been changed and make zpool
# use the new partition which is actually the same one
sudo zpool online -e lxd /var/lib/lxd/zfs.img /var/lib/lxd/zfs.img
@keepitsimple
keepitsimple / async_tor_proxy_sample.py
Last active March 18, 2025 15:06
aiohttp + aiosocks: async tor proxy example
import asyncio
import aiohttp
import aiosocks
from aiosocks.connector import ProxyConnector, ProxyClientRequest
async def main():
async with aiohttp.ClientSession() as session:
async with session.get('http://icanhazip.com/') as resp:
@keepitsimple
keepitsimple / tutorial.md
Created August 7, 2018 11:45 — forked from swalkinshaw/tutorial.md
Designing a GraphQL API

Tutorial: Designing a GraphQL API

This tutorial was created by Shopify for internal purposes. We've created a public version of it since we think it's useful to anyone creating a GraphQL API.

It's based on lessons learned from creating and evolving production schemas at Shopify over almost 3 years. The tutorial has evolved and will continue to change in the future so nothing is set in stone.

@keepitsimple
keepitsimple / ip4.js
Last active August 8, 2018 14:40
JavaScript the best RegEx for IPv4 validation with test examples
const ip4RegEx = /^(?:(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])(\.(?!$)|$)){4}$/
/*
//valid
127.0.0.1
192.168.1.1
192.168.1.255
255.255.255.255
0.0.0.0
1.1.1.1
@keepitsimple
keepitsimple / daemon.json
Created August 13, 2018 16:08
docker config file optimal configuration for Linux 4.x
# from here: https://sandro-keil.de/blog/2017/01/23/docker-daemon-tuning-and-json-file-configuration/
{
"storage-driver": "overlay2",
"graph": "/var/lib/docker",
"log-driver": "json-file",
"log-opts": {
"max-size": "10m",
"max-file": "2"
},