Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
# shows the lyrics for the currently playing song on Spotify
artist=$(spotifycli --artist)
song=$(spotifycli --song | cut -f1 -d"-" | cut -f1 -d"(")
echo "artist: $artist"
echo "song: $song"
glyrics "$song $artist"
@sungwoncho
sungwoncho / dnote-cla
Last active January 26, 2019 10:28
dnote-cla
Individual Contributor License Agreement
Thank you for your interest in the project, owned by Monomax Software (the "Company"). In order to clarify the intellectual property license granted with Contributions from any person or entity, the Company must have a Contributor License Agreement ("CLA") on file that has been signed by each Contributor, indicating agreement to the license terms below. This license is for your protection as a Contributor as well as the protection of the Company and its users; it does not change your rights to use your own Contributions for any other purpose.
You accept and agree to the following terms and conditions for Your present and future Contributions submitted to the Company. In return, the Company shall not use Your Contributions in a way that is contrary to the public benefit or inconsistent with its bylaws in effect at the time of the Contribution. Except for the license granted herein to the Company and recipients of software distributed by the Company, You reserve all ri
@sungwoncho
sungwoncho / capture_slides.js
Created July 22, 2017 11:34
A script to capture slides from reveal.js presentation
var webshot = require('webshot');
var maxSlideNumber = 17
var opt = { windowSize: { width: 1440
, height: 799 }};
webshot('https://sungwoncho.github.io/presentations/20170727-graphdb-node-stackoverflow.html#/', 'slide0.png', opt, function(err) {
if (err) {
console.log(err)
@sungwoncho
sungwoncho / calculate_remote_score.js
Last active July 22, 2017 08:57
RemoteBase - RemoteScore formula
/**
* Calculate RemoteScore in https://remotebase.io
*
* Currently all RemoteScores are computed in the browser using JavaScript.
* In the future, this logic might be brought to the server-side so that the public API can query it.
*
* Note: RemoteBase public API - https://remotebase.github.io/remotebase-api/
*/
const remoteScoreWeights = {
#!/bin/sh
set -eu
not_supported() {
echo "OS not supported: ${UNAME}"
echo "Please compile manually from https://github.com/dnote-io/cli"
exit 1
}
@sungwoncho
sungwoncho / aws_lightsail_bootstrap.sh
Last active August 5, 2017 04:42
Bootstrap a fresh Ubuntu 16 instance
#!/bin/bash
# bootstrap a fresh instance running Ubuntu 16.04
sudo apt-get update
sudo apt-get install -y zsh
sudo apt-get install -y nginx
sudo apt-get install -y tmux
sudo apt-get install -y postgresql postgresql-contrib
# nginx stuff
import React from 'react';
import ReactDOM from 'react-dom';
import { Router, browserHistory } from 'react-router';
import { Provider } from 'react-redux';
import ReactGA from 'react-ga';
import getRoutes from './routes';
import ApiClient from './libs/api_client';
import configureStore from './configureStore';
import { ReduxAsyncConnect } from 'redux-connect';
#!/bin/bash
# Store the filenames of previous build
PREVIOUS_BUILD=(./static/dist/*)
function fetch {
echo "###### Fetching..."
git pull origin prod
git checkout prod
}
login(req, res) {
const { username, shaHash } = req.body;
res.setHeader('Content-Type', 'application/json');
User.findOne({ username, verified: true }, (err, user) => {
if (!user) {
console.log('No user with that username found or not verified');
res.status(500);
res.end();
return;
export function sendJobAlertEmail() {
console.log('CRON: sending alert email');
function handleJobs(jobs, user, notifiableJobs, done) {
each(jobs, (job, n) => {
Notification.count({ jobId: job._id, userId: user._id }, (err, count) => {
if (count > 0) {
console.log('notificaiton already sent');
return n();
}