Skip to content

Instantly share code, notes, and snippets.

@Tug
Tug / cockroach_to_postgres.sh
Last active March 28, 2024 12:59
Convert Cockroach DDL export to Postgres
#!/usr/bin/env bash
# Adapted from https://dev.to/franckpachot/moving-data-from-cockroachdb-to-postgresql-or-yugabytedb-462h
input_sql=$1
gawk '
# Create extensions that are default in CR
NR==1 {
print "create extension if not exists pgcrypto;" > ("tab-" FILENAME)
@Tug
Tug / Output from gutenberg mobile
Created April 23, 2020 16:39
Metro debugging scss imports
transform[stdout]: babelConfig { sourceType: 'unambiguous',
transform[stdout]: plugins: [ [Function: ReactFreshBabelPlugin] ],
transform[stdout]: extends:
transform[stdout]: '/Users/tug/Work/gutenberg-mobile-master/gutenberg/packages/react-native-editor/babel.config.js',
transform[stdout]: babelrc: true,
transform[stdout]: code: true,
transform[stdout]: filename: '../rich-text/src/component/index.native.js',
transform[stdout]: highlightCode: true,
transform[stdout]: caller: { name: 'metro', platform: 'android' },
transform[stdout]: ast: true }
@Tug
Tug / override-console.patch
Created March 14, 2019 17:02
Override console experiment for mobile-gutenberg
diff --git a/react-native-gutenberg-bridge/logger.js b/react-native-gutenberg-bridge/logger.js
index 8b09dda3..577e191b 100644
--- a/react-native-gutenberg-bridge/logger.js
+++ b/react-native-gutenberg-bridge/logger.js
@@ -5,27 +5,27 @@ import { NativeModules } from 'react-native';
const { RNReactNativeGutenbergBridge } = NativeModules;
-const logger = {
- debug: ( message ) => {
diff --git a/packages/rich-text/src/apply-format.native.js b/packages/rich-text/src/apply-format.native.js
index 9c5a4749a..2d2fa9829 100644
--- a/packages/rich-text/src/apply-format.native.js
+++ b/packages/rich-text/src/apply-format.native.js
@@ -35,7 +35,7 @@ export function applyFormat(
// The selection is collpased, insert a placeholder with the format so new input appears
// with the format applied.
if ( startIndex === endIndex ) {
- const previousFormats = currentFormats[ startIndex - 1 ] || [];
+ const previousFormats = currentFormats[ startIndex > 0 ? startIndex - 1 : 0 ] || [];
@Tug
Tug / debug-with-aztec.patch
Last active January 22, 2019 10:14
Make aztec changes in gutenberg-mobile
diff --git a/android/build.gradle b/android/build.gradle
index 228e5f3..6924ae9 100644
--- a/android/build.gradle
+++ b/android/build.gradle
@@ -1,7 +1,8 @@
buildscript {
ext {
- gradlePluginVersion = '3.1.0'
- kotlinVersion = '1.2.31'
+ gradlePluginVersion = '3.1.3'
diff --git a/android/build.gradle b/android/build.gradle
index fc7f557..922f885 100644
--- a/android/build.gradle
+++ b/android/build.gradle
@@ -1,7 +1,8 @@
buildscript {
ext {
- gradlePluginVersion = '3.1.0'
- kotlinVersion = '1.2.31'
+ gradlePluginVersion = '3.1.3'
⋊> ~ mongo --port 37019 --verbose 00:50:57
MongoDB shell version: 3.2.9
connecting to: 127.0.0.1:37019/test
2016-12-30T00:51:00.735+0900 D NETWORK [thread1] creating new connection to:127.0.0.1:37019
2016-12-30T00:51:00.735+0900 D COMMAND [ConnectBG] BackgroundJob starting: ConnectBG
2016-12-30T00:51:00.736+0900 D NETWORK [thread1] connected to server 127.0.0.1:37019 (127.0.0.1)
2016-12-30T00:53:08.736+0900 D NETWORK [thread1] connected connection!
Server has startup warnings:
2016-12-20T00:39:10.418+0100 I CONTROL [initandlisten]
2016-12-20T00:39:10.418+0100 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'.
@Tug
Tug / .bashrc
Created February 15, 2016 13:09
simple svn stash aliases and function
alias svn-stash='svn diff | pb >> ~/.svn_stack && svn revert -R .'
alias svn-stash-list='cat ~/.svn_stack'
function stash_pop() {
line=$(grep -n "$1" ~/.svn_stack | cut -d : -f 1)
if [ -z "$line" ]; then
line=$(wc -l < ~/.svn_stack)
fi
pastebin_url=$(sed "${line}q;d" ~/.svn_stack)
if [ -n "$pastebin_url" ]; then
pb "${pastebin_url}" | patch -p0
@Tug
Tug / after native_parser=true
Created January 10, 2014 21:28
profiling of nirror with and without the use of the native parser in node-mongodb-native
Statistical profiling result from v8.log, (49355 ticks, 90 unaccounted, 0 excluded).
[Unknown]:
ticks total nonlib name
90 0.2%
[Shared libraries]:
ticks total nonlib name
36960 74.9% 0.0% /lib/x86_64-linux-gnu/libc-2.17.so
6486 13.1% 0.0% /usr/local/bin/node
var express = require("express"),
app = express();
app.configure(function(){
app.use(express.static(__dirname + '/public'));
});
app.listen(13000);