This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// specs -> https://www.w3.org/Graphics/JPEG/jfif3.pdf | |
// Suppose you have a JPEG file with the following segments: | |
// SOI (Start of Image): FFD8 | |
// APP0 (JFIF): FFE0 followed by length and JFIF metadata | |
// DQT (Quantization Table): FFDB followed by length and quantization table data | |
// SOF0 (Baseline DCT): FFC0 followed by length and frame information | |
// DHT (Huffman Table): FFC4 followed by length and Huffman tables | |
// SOS (Start of Scan): FFDA followed by length and scan parameters | |
// Compressed Image Data: Huffman-encoded DCT coefficients |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
setup: | |
python3 -m pip install -r requirements.pip | |
run: | |
rm -rf logs/* | |
aws s3 sync s3://<bucket>/AWSLogs/<account-id>/elasticloadbalancing/<region>/<year>/<month>/<day>/ `pwd`/logs | |
cd logs && gunzip *.log.gz | |
python3 upload.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3.7 | |
# As described by Daniela Baron -> https://danielabaron.me/blog/iterm-automation/ | |
# | |
# The contents of a sample commands definition file may look like so: | |
# [ | |
# { | |
# "title": "usrv", | |
# "panes": [ | |
# { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def project = 'ekowcharles/jenkins-jobs-repo' | |
def branchApi = new URL("https://api.github.com/repos/${project}/branches") | |
def branches = new groovy.json.JsonSlurper().parse(branchApi.newReader()) | |
branches.each { | |
def branchName = it.name | |
def jobName = "${project}-${branchName}".replaceAll('/','-') | |
pipelineJob(jobName) { | |
triggers { | |
scm('* * * * *') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Preferences > Settings > Workbench > Appearance > Edit settings.json | |
"workbench.colorCustomizations": { | |
"terminal.foreground": "#839496", | |
"terminal.background": "#002b36", | |
"terminalCursor.background": "#A89984", | |
"terminalCursor.foreground": "#A89984", | |
"terminal.ansiBlack": "#073642", | |
"terminal.ansiBlue": "#268bd2", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function isObject(obj) { | |
var type = typeof obj; | |
return (type === 'function' || type === 'object') && !!obj; | |
} | |
function isArray(obj) { | |
return obj instanceof Array | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* ESP8266 Web server with Web Socket to control an LED. | |
* | |
* The web server keeps all clients' LED status up to date and any client may | |
* turn the LED on or off. | |
* | |
* For example, clientA connects and turns the LED on. This changes the word | |
* "LED" on the web page to the color red. When clientB connects, the word | |
* "LED" will be red since the server knows the LED is on. When clientB turns | |
* the LED off, the word LED changes color to black on clientA and clientB web |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Model | |
@user.should have(1).error_on(:username) # Checks whether there is an error in username | |
@user.errors[:username].should include("can't be blank") # check for the error message | |
#Rendering | |
response.should render_template(:index) | |
#Redirecting | |
response.should redirect_to(movies_path) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=Navigating= | |
visit('/projects') | |
visit(post_comments_path(post)) | |
=Clicking links and buttons= | |
click_link('id-of-link') | |
click_link('Link Text') | |
click_button('Save') | |
click('Link Text') # Click either a link or a button | |
click('Button Value') |