Skip to content

Instantly share code, notes, and snippets.

View usmonster's full-sized avatar
🫖

Usman usmonster

🫖
  • Paris, New York, Internet
View GitHub Profile
@aslafy-z
aslafy-z / Jenkinsfile
Last active December 13, 2023 19:52 — forked from rufoa/Jenkinsfile
Jenkins [skip ci] implementation for multi-branch declarative pipeline
pipeline {
...
stages {
stage('Run CI?') {
steps {
script {
if (sh(script: "git log -1 --pretty=%B | grep -F -ie '[skip ci]' -e '[ci skip]'", returnStatus: true) == 0) {
currentBuild.result = 'NOT_BUILT'
error 'Aborting because commit message contains [skip ci]'
@rufoa
rufoa / Jenkinsfile
Created May 13, 2019 02:29
Jenkins [skip ci] implementation for multi-branch declarative pipeline
// change 'agent' lines as appropriate
pipeline {
agent none
stages {
stage('Run CI?') {
agent any
steps {
@ahmed-musallam
ahmed-musallam / compress_pdf.md
Last active March 10, 2024 13:53
How to compress PDF with ghostscript

How to compress PDF using ghostscript

As a developer, it bothers me when someone sends me a large pdf file compared to the number of pages. Recently, I recieved a 12MB scanned document for just one letter-sized page... so I got to googlin, like I usually do, and found ghostscript!

to learn more abot ghostscript (gs): https://www.ghostscript.com/

What we are interested in, is the gs command line tool, which provides many options for manipulating PDF, but we are interested in compressign those large PDF's into small yet legible documents.

credit goes to this answer on askubuntu forum: https://askubuntu.com/questions/3382/reduce-filesize-of-a-scanned-pdf/3387#3387?newreg=bceddef8bc334e5b88bbfd17a6e7c4f9

@jonico
jonico / Jenkinsfile
Last active January 31, 2024 09:43
Example for a full blown Jenkins pipeline script with CodeQL analysis steps, multiple stages, Kubernetes templates, shared volumes, input steps, injected credentials, heroku deploy, sonarqube and artifactory integration, Docker containers, multiple Git commit statuses, PR merge vs branch build detection, REST API calls to GitHub deployment API, …
#!groovy
import groovy.json.JsonOutput
import groovy.json.JsonSlurper
def label = "mypod-${UUID.randomUUID().toString()}"
podTemplate(label: label, yaml: """
spec:
containers:
- name: mvn
image: maven:3.3.9-jdk-8
@qmahoney
qmahoney / header.bash
Last active December 18, 2020 20:12
Fake Athena header page
#!/bin/bash
# Copy banner.ps and owl.ps from:
# http://athena10.mit.edu/trac/browser/trunk/third/lprng/athena?rev=13556
echo "/user (`whoami`) def" > vars.ps
echo "/host (`hostname`) def" >> vars.ps
echo "/queuejob () def" >> vars.ps
echo "/date (`date +"%A, %e %B %Y %H:%M:%S"`) def" >> vars.ps
echo "/motd () def" >> vars.ps
@subfuzion
subfuzion / curl.md
Last active April 23, 2024 14:44
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@afeld
afeld / slack_reactions.js
Last active September 18, 2021 19:59
get emoji reactions for a message in Slack – unfortunately their API "might not always contain all users that have reacted". limited to 50 as of 2/12/16.
'use strict';
const Promise = require('bluebird');
const WebClient = require('slack-client').WebClient;
const token = process.env.SLACK_API_TOKEN;
if (!token) {
throw "Please set SLACK_API_TOKEN";
}
@brock
brock / psql-with-gzip-cheatsheet.sh
Last active April 10, 2024 10:53
Exporting and Importing Postgres Databases using gzip
# This is just a cheat sheet:
# On production
sudo -u postgres pg_dump database | gzip -9 > database.sql.gz
# On local
scp -C production:~/database.sql.gz
dropdb database && createdb database
gunzip < database.sql.gz | psql database
@paulirish
paulirish / what-forces-layout.md
Last active April 25, 2024 21:49
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@usmonster
usmonster / textContent.js
Last active April 11, 2024 06:18 — forked from eligrey/textContent.js
Updated Node.prototype.textContent shim for IE8 ONLY
(function() {
// inspired by Eli Grey's shim @ http://eligrey.com/blog/post/textcontent-in-ie8
// heavily modified to better match the spec:
// http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#Node3-textContent
if (Object.defineProperty && Object.getOwnPropertyDescriptor &&
Object.getOwnPropertyDescriptor(Element.prototype, 'textContent') &&
!Object.getOwnPropertyDescriptor(Element.prototype, 'textContent').get) {
// NOTE: Neither of these "drop-in" patterns would work:
// Object.defineProperty(..., ..., descriptor); // nope!