View shrink_db.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DROP FUNCTION IF EXISTS shrink_db; | |
CREATE FUNCTION shrink_db() RETURNS VOID AS $$ | |
DECLARE | |
r RECORD; | |
BEGIN | |
DROP TABLE IF EXISTS work1; | |
CREATE TEMP TABLE work1 AS SELECT | |
CONCAT('ALTER TABLE ', nsp.nspname, '.', rel.relname, ' DROP CONSTRAINT "', con.conname, '";') delete_query, | |
CONCAT('ALTER TABLE ', nsp.nspname, '.', rel.relname, ' ADD CONSTRAINT ', con.conname, ' ', pg_get_constraintdef(con.oid), ' ON DELETE CASCADE;') create_cascade, | |
CONCAT('ALTER TABLE ', nsp.nspname, '.', rel.relname, ' ADD CONSTRAINT ', con.conname, ' ', pg_get_constraintdef(con.oid)) create_original, |
View CatWeight.ino
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Arduino.h> | |
#include <M5Stack.h> | |
#include <WiFi.h> | |
#include <HTTPClient.h> | |
#define CYAN 0x07FF | |
#define ORANGE 0xFDA0 | |
#define LIGHTGRAY 0xC618 | |
#define FW 6 | |
#define FH 8 |
View cat_weight_scale.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function doGet(e) { | |
var now = new Date(); | |
var sheet = getSheetOfDate(now); | |
var rawWeightFrom = e && e.parameter && e.parameter.raw_weight_from; | |
var rawWeightTo = e && e.parameter && e.parameter.raw_weight_to; | |
var etc = e && e.parameter && e.parameter.etc; | |
var response; | |
if (rawWeightTo) { | |
// https://stackoverflow.com/a/17637159 |
View ConvertFirebaseAnalyticsLog.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WITH SRC AS ( | |
SELECT | |
_TABLE_SUFFIX ldate, | |
* | |
FROM `hoge.analytics_123456789.events_intraday_*` | |
-- WHERE _TABLE_SUFFIX = '2019-07-25' | |
), | |
TD_COMPAT AS ( |
View mutter_fix_scroll.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- ./mutter-3.30.2_orig/src/core/meta-workspace-manager.c 2019-05-22 05:46:37.667434418 +0900 | |
+++ ./mutter-3.30.2/src/core/meta-workspace-manager.c 2019-05-22 05:46:46.859495121 +0900 | |
@@ -200,6 +200,8 @@ meta_workspace_manager_new (MetaDisplay | |
* variable values in update_num_workspaces () | |
* This can be overriden using _NET_DESKTOP_LAYOUT in | |
* meta_x11_display_new (), if it's specified */ | |
+ workspace_manager->workspace_layout_overridden = FALSE; | |
+ | |
meta_workspace_manager_update_workspace_layout (workspace_manager, | |
META_DISPLAY_TOPLEFT, |
View MakerbotReplicatorDualForCura
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": 2, | |
"name": "My Custom", | |
"inherits": "fdmprinter", | |
"metadata": { | |
"visible": true, | |
"author": "Ultimaker", | |
"manufacturer": "Custom", | |
"category": "Custom", | |
"file_formats": "text/x-gcode", |
View launch-emurators.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
NUM=$1 | |
if [[ ! "$NUM" =~ ^[0-9]+$ ]] || [ "$NUM" -le 0 ]; then | |
echo "Usage: launch-emurators.sh <num>" | |
exit | |
fi | |
EMULATOR_PIDS="" |
View pullFromQueryParams.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TEMPORARY FUNCTION pullFromQueryParams(s string, key string) | |
RETURNS string | |
LANGUAGE js AS """ | |
// function pullFromQueryParams(s, key) { | |
if (!s) return null; | |
var ts = s.split("&"); | |
for (var i = 0;i<ts.length;i++) { | |
var vs = ts[i].split("=",2); | |
if (vs[0] == key && vs.length >= 2) { | |
return decodeURIComponent(vs[1]); |
View convert_odp_gif_apng.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ -z "$1" -o -z "$2" ]; then | |
echo "Usage: $0 <from_file> <to_file>" | |
exit | |
fi | |
FROM_FILE=$1 | |
TO_FILE=$2 | |
WORK_DIR=_tmp |
View 51-android.rules
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Acer | |
SUBSYSTEM=="usb", ATTR{idVendor}=="0502", MODE="0660", GROUP="plugdev" | |
# ASUS | |
SUBSYSTEM=="usb", ATTR{idVendor}=="0b05", MODE="0660", GROUP="plugdev" | |
# Dell | |
SUBSYSTEM=="usb", ATTR{idVendor}=="413c", MODE="0660", GROUP="plugdev" | |
# Foxconn | |
SUBSYSTEM=="usb", ATTR{idVendor}=="0489", MODE="0660", GROUP="plugdev" | |
# Fujitsu | |
SUBSYSTEM=="usb", ATTR{idVendor}=="04c5", MODE="0660", GROUP="plugdev" |
NewerOlder