Skip to content

Instantly share code, notes, and snippets.

View indatawetrust's full-sized avatar
🏠
Working from home

indatawetrust

🏠
Working from home
View GitHub Profile
find . "..." -not -path "./node_modules/*" -not -path "./.git/*" -not -path "./public/*"
grep -rnw . -e "..." --exclude-dir={node_modules,.git,public}
mysql.server start
sudo mkfs.ext4 -m 0 -F -E lazy_itable_init=0,lazy_journal_init=0,discard /dev/sdb
sudo mkdir -p /mnt/disks/sdb
sudo mount -o discard,defaults /dev/sdb /mnt/disks/sdb
sum -> sum "+" product {% d => d[0] + d[2] %}
| sum "-" product {% d => d[0] - d[2] %}
| product {% d => d[0] %}
product -> product "*" factor {% d => d[0] * d[2] %}
| product "/" factor {% d => d[0] / d[2] %}
| factor {% d => d[0] %}
factor -> "(" sum ")" {% d => d[1] %}
| float {% d => d[0] %}
float -> num "." num {% d => parseFloat(d[0] + d[1] + d[2]) %}
| num {% d => parseInt(d[0]) %}
@indatawetrust
indatawetrust / wp_categories.sql
Created January 11, 2019 11:05
wordpress categories and total courses
SELECT t.term_id,
t.name,
t.slug,
count(post.ID) AS total
FROM wp_terms AS t
INNER JOIN wp_term_taxonomy AS tt ON (t.term_id = tt.term_id)
INNER JOIN wp_term_relationships AS tr ON (tr.term_taxonomy_id = tt.term_taxonomy_id)
LEFT JOIN wp_posts post ON (post.ID = tr.object_id)
WHERE tt.taxonomy IN ('course_category')
GROUP BY t.term_id
@indatawetrust
indatawetrust / web-push.js
Created January 9, 2019 09:36
web-push with nodejs
const OneSignal = require('onesignal-node');
const client = new OneSignal.Client({
app: {
appAuthKey: '*',
appId: '*',
},
});
const notification = new OneSignal.Notification({
#!/bin/bash
. $HOME/.nvm/nvm.sh
yarn build
SELECT t.term_id, t.name, t.slug
FROM wp_terms AS t
INNER JOIN wp_term_taxonomy AS tt ON (t.term_id = tt.term_id)
INNER JOIN wp_term_relationships AS tr ON (tr.term_taxonomy_id = tt.term_taxonomy_id)
WHERE tt.taxonomy IN ('course_category') AND tr.count > 0
ORDER BY t.name ASC
wget http://central.maven.org/maven2/io/swagger/swagger-codegen-cli/2.3.1/swagger-codegen-cli-2.3.1.jar -O swagger-codegen-cli.jar
apt install default-jre
alias swagger="java -jar swagger-codegen-cli.jar"
const https = require('https');
https.get('https://ifconfig.co/json', resp => {
let data = '';
resp.on('data', chunk => {
data += chunk;
});
resp.on('end', () => {
@indatawetrust
indatawetrust / s.js
Last active November 12, 2018 17:02
string js
const string = require("string");
const s = (text, func, ...params) => string(text)[func](...params).s;