Skip to content

Instantly share code, notes, and snippets.

View peterjenkins1's full-sized avatar
🪇

Peter Jenkins peterjenkins1

🪇
View GitHub Profile
@yishn
yishn / takeScreenShot.js
Created November 21, 2019 12:27
Take screenshot in the browser
const canIRun = navigator.mediaDevices.getDisplayMedia
const takeScreenShot = async () => {
const stream = await navigator.mediaDevices.getDisplayMedia({
video: { mediaSource: 'screen' },
})
// get correct video track
const track = stream.getVideoTracks()[0]
// init Image Capture and not Video stream
const imageCapture = new ImageCapture(track)
@bastman
bastman / docker-cleanup-resources.md
Created March 31, 2016 05:55
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

@aespinosa
aespinosa / job.groovy
Last active September 16, 2024 18:27
create a jenkins job in the script console
import jenkins.model.Jenkins;
import hudson.model.FreeStyleProject;
import hudson.tasks.Shell;
job = Jenkins.instance.createProject(FreeStyleProject, 'job-name')
job.buildersList.add(new Shell('echo hello world'))
job.save()
@djoreilly
djoreilly / keystone_v3_session.py
Created March 1, 2016 11:10
Howto use the python-novaclient and python-neutronclient with Keystone V3
# http://docs.openstack.org/developer/keystoneauth/index.html
# http://www.jamielennox.net/blog/2014/09/15/how-to-use-keystoneclient-sessions/
# In iPython: execfile('path/to/this/file')
import os
import logging
from keystoneauth1.identity import v3
from keystoneauth1 import session
@Kartones
Kartones / postgres-cheatsheet.md
Last active November 15, 2024 21:14
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@mattratleph
mattratleph / vimdiff.md
Last active October 16, 2024 17:26 — forked from roothybrid7/vimdiff_cheet.md
vimdiff cheat sheet

vimdiff cheat sheet

##git mergetool

In the middle file (future merged file), you can navigate between conflicts with ]c and [c.

Choose which version you want to keep with :diffget //2 or :diffget //3 (the //2 and //3 are unique identifiers for the target/master copy and the merge/branch copy file names).

:diffupdate (to remove leftover spacing issues)

:only (once you’re done reviewing all conflicts, this shows only the middle/merged file)