Skip to content

Instantly share code, notes, and snippets.

@h3
h3 / color.py
Last active June 27, 2019 19:38
Simple shell color outpout function
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import re
import sys
def c(i):
"""
@LindaLawton
LindaLawton / GoogleAuthenticationCurl.sh
Last active August 8, 2023 14:08
Curl bash script for getting a Google Oauth2 Access token
# Tutorial https://www.daimto.com/how-to-get-a-google-access-token-with-curl/
# YouTube video https://youtu.be/hBC_tVJIx5w
# Client id from Google Developer console
# Client Secret from Google Developer console
# Scope this is a space seprated list of the scopes of access you are requesting.
# Authorization link. Place this in a browser and copy the code that is returned after you accept the scopes.
https://accounts.google.com/o/oauth2/auth?client_id=[Application Client Id]&redirect_uri=http://127.0.0.1&scope=[Scopes]&response_type=code
# Exchange Authorization code for an access token and a refresh token.
@Faheetah
Faheetah / Jenkinsfile.groovy
Last active March 6, 2024 18:14
Jenkinsfile idiosynchrasies with escaping and quotes
node {
echo 'Results included as an inline comment exactly how they are returned as of Jenkins 2.121, with $BUILD_NUMBER = 1'
echo 'No quotes, pipeline command in single quotes'
sh 'echo $BUILD_NUMBER' // 1
echo 'Double quotes are silently dropped'
sh 'echo "$BUILD_NUMBER"' // 1
echo 'Even escaped with a single backslash they are dropped'
sh 'echo \"$BUILD_NUMBER\"' // 1
echo 'Using two backslashes, the quotes are preserved'
sh 'echo \\"$BUILD_NUMBER\\"' // "1"
@renzok
renzok / Dockerfile
Last active September 6, 2023 04:55
docker: mapping host uid and gid to user inisde container
FROM debian:jessie
ENV USER=boatswain USER_ID=1000 USER_GID=1000
# now creating user
RUN groupadd --gid "${USER_GID}" "${USER}" && \
useradd \
--uid ${USER_ID} \
--gid ${USER_GID} \
--create-home \
! Clear modifiers
clear lock
clear mod1
clear mod4
clear mod5
! for awesome it is convenient to have two mod4, one for each hand
! between left ctrl and left alt
! XXX: arent these the defaults?
keycode 133 = Super_L
@mattvonrocketstein
mattvonrocketstein / pyack
Created February 8, 2012 01:34
a dumb interface for getting ack data into python
""" pyack
a dumb interface for getting ack data into python
USAGE:
call it with a given search string or directory
>>> z = pyack('search_string')
>>> z = pyack('search_string directory')
>>> z = pyack('search_string directory --whatever-ack-args')