Skip to content

Instantly share code, notes, and snippets.

@tvaliasek
tvaliasek / main.js
Created June 5, 2018 20:09
electron axios stream download with progress
import {ipcMain} from 'electron'
const fs = require('fs')
const axios = require('axios')
/* ... */
ipcMain.on('downloadFile', function (event, data) {
const filePath = data.filePath
const item = data.item
@davidhooey
davidhooey / oracle_blocker_blocked_sess_history.sql
Last active November 21, 2023 18:30
Oracle blocker and blocked session information from history.
select distinct
-- Snapshot ID
min(blocked.snap_id) as first_snap_id,
max(blocked.snap_id) as last_snap_id,
-- Sample ID and Time
min(blocked.sample_id) as first_sample_id,
min(blocked.sample_id) as last_sample_id,
to_char(
min(blocked.sample_time),
@nolanlawson
nolanlawson / protips.js
Last active February 4, 2024 18:06
Promise protips - stuff I wish I had known when I started with Promises
// Promise.all is good for executing many promises at once
Promise.all([
promise1,
promise2
]);
// Promise.resolve is good for wrapping synchronous code
Promise.resolve().then(function () {
if (somethingIsNotRight()) {
throw new Error("I will be rejected asynchronously!");
@kenrett
kenrett / Selenium Cheat Sheet.md
Last active May 25, 2023 01:28
Selenium Cheat Sheet - Ruby

#Getting Started

##Webpage:

<html>
<head>
    <title>Testing with Ruby and Selenium WebDriver</title>
</head>
 
<body bgcolor="antiquewhite">
@davidhooey
davidhooey / oracle_wait_events_for_sqlid.sql
Created September 17, 2013 13:58
Oracle Wait Events for SQL_ID
-- Shared Pool
select
event,
time_waited "time_waited(s)",
case when time_waited = 0 then
0
else
round(time_waited*100 / sum(time_waited) Over(), 2)
end "percentage"
from
@erwanjegouzo
erwanjegouzo / gist:5903791
Last active March 8, 2019 20:49
Dropbox sync
#DROPBOX SYNCING
#==============
# bash_profile
rm -rf .bash_profile
ln -s ~/Dropbox/.bash_profile .bash_profile
# Sublime 2 Preferences
cd ~/Library/Application\ Support/Sublime\ Text\ 2/
ln -s ~/Dropbox/appdata/sublime/Installed\ Packages ./Installed\ Packages
@huangzhichong
huangzhichong / selenium-webdriver-cheatsheet.md
Created August 7, 2012 12:38
Selenium Webdriver CheatSheet

API workthough

  1. Open a browser

    # start an instance of firefox with selenium-webdriver
    driver = Selenium::WebDriver.for :firefox
    # :chrome -> chrome
    # :ie     -> iexplore
    
  • Go to a specified URL
@kconragan
kconragan / keyrepeat.shell
Last active December 4, 2023 03:40
Enable key repeat in Apple Lion for Sublime Text in Vim mode
# Mac OS X Lion introduced a new, iOS-like context menu when you press and hold a key
# that enables you to choose a character from a menu of options. If you are on Lion
# try it by pressing and holding down 'e' in any app that uses the default NSTextField
# for input.
#
# It's a nice feature and continues the blending of Mac OS X and iOS features. However,
# it's a nightmare to deal with in Sublime Text if you're running Vintage (Vim) mode,
# as it means you cannot press and hold h/j/k/l to move through your file. You have
# to repeatedly press the keys to navigate.