Skip to content

Instantly share code, notes, and snippets.

View wilomgfx's full-sized avatar
🧙‍♂️
Focus pocus

William Cantin wilomgfx

🧙‍♂️
Focus pocus
View GitHub Profile
import { useEffect } from 'react';
const importScript = resourceUrl=> {
useEffect(() => {
const script = document.createElement('script');
script.src = resourceUrl;
script.async = true;
document.body.appendChild(script);
return () => {
document.body.removeChild(script);
}
@wilomgfx
wilomgfx / restore.sh
Created January 26, 2019 22:13 — forked from jgillman/restore.sh
pg_restore a local db dump into Docker
# Assumes the database container is named 'db'
DOCKER_DB_NAME="$(docker-compose ps -q db)"
DB_HOSTNAME=db
DB_USER=postgres
LOCAL_DUMP_PATH="path/to/local.dump"
docker-compose up -d db
docker exec -i "${DOCKER_DB_NAME}" pg_restore -C --clean --no-acl --no-owner -U "${DB_USER}" -d "${DB_HOSTNAME}" < "${LOCAL_DUMP_PATH}"
docker-compose stop db
@wilomgfx
wilomgfx / install-psycopg2-venv-macso.sh
Created January 26, 2019 20:46 — forked from geekforbrains/shell.sh
Installing psycopg2 in virtualenv on macOS Sierra
$ xcode-select --install
$ brew install openssl
$ virtualenv env
$ . env/bin/activate
$(env) env LDFLAGS="-I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib" pip install psycopg2
//For example, to override the AppBar (https://material-ui-next.com/api/app-bar/) root class we can do the following:
// First method (override Material UI classnames):
// 1 - Add the property classes in the AppBar component:
<AppBar classes={{root: 'my-root-class'}}
// 2 - Override the styles with the styled components:
styled(AppBar)`
&.my-root-class {
z-index: 1500;
}
@wilomgfx
wilomgfx / extract_realm_database_android.sh
Last active April 11, 2017 16:28 — forked from jk2K/extract_realm_database_android.sh
how to export realm database, work on Android 5.0+
#!/bin/bash
ADB_PATH="/Users/${USER}/Library/Android/sdk/platform-tools"
PACKAGE_NAME="com.yourcompany.app"
DB_NAME="default.realm"
DESTINATION_PATH="/Users/${USER}/Downloads/${DB_NAME}"
NOT_PRESENT="List of devices attached"
ADB_FOUND=`${ADB_PATH}/adb devices | tail -2 | head -1 | cut -f 1 | sed 's/ *$//g'`
if [[ ${ADB_FOUND} == ${NOT_PRESENT} ]]; then
echo "Make sure a device is connected"
else
@wilomgfx
wilomgfx / appify.sh
Last active February 8, 2017 16:59 — forked from oubiwann/appify.sh
appify — create the simplest possible Mac app from a shell script (adds an application icon)
#!/usr/bin/env bash
VERSION=4.0.1
SCRIPT=`basename "$0"`
APPNAME="My App"
APPICONS="/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/GenericApplicationIcon.icns"
OSX_VERSION=`sw_vers -productVersion`
PWD=`pwd`
function usage {
@wilomgfx
wilomgfx / ContextCmder-Disable.reg
Created November 30, 2016 03:09 — forked from jojobyte/ContextCmder-Disable.reg
Cmder Context (Right-Click) Menu for Windows 7/8
Windows Registry Editor Version 5.00
[-HKEY_CLASSES_ROOT\Directory\Background\shell\Cmder]
[-HKEY_CLASSES_ROOT\Directory\shell\Cmder]