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
func getMode(testArray []int) (mode int) { | |
// Create a map and populated it with each value in the slice | |
// mapped to the number of times it occurs | |
countMap := make(map[int]int) | |
for _, value := range testArray { | |
countMap[value] += 1 | |
} | |
// Find the smallest item with greatest number of occurance in | |
// the input slice |
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
require 'socket' | |
server_port = 1337 | |
server = TCPServer.open(server_port) #create TCP socket | |
puts "[*] Listening on port #{server_port}" | |
# create loop to deal with incoming connections | |
loop do | |
while client = server.accept | |
fork do # create new process for each connection | |
puts "[*] Connection from: #{client.peeraddr}" |
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
#!/bin/bash | |
# Setup docker-ce and docker compose | |
if [[ $EUID -ne 0 ]]; then | |
echo "This script must be run as root" | |
exit 1 | |
fi | |
dockerComposeVersion=1.15.0 # latest version of compose as of 8/2/17 |
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
require 'ipaddr' | |
require 'nokogiri' | |
# Helper functions | |
def debug_message(output) | |
puts "[##] Debug: #{output}" | |
end | |
def pluralize(subject) | |
's' if subject.size > 1 |
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 prompt_user_input(message, defualt_value) | |
print(message) | |
input = readline() | |
value_entered =(input.len > 0) && (input.len < 128) | |
return value_entered ? input : defualt_value | |
end | |
function prompt_user_cont() | |
return contains(==, lowercase(prompt_user_input("We still doin' dis? [Y/n]: ", "y")), 'y') | |
end |
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
#!/bin/bash | |
if [[ $EUID -ne 0 ]]; then | |
echo "[!!] This script must be run as root" | |
exit 1 | |
fi | |
wget -nv https://download.opensuse.org/repositories/shells:fish:release:2/Debian_9.0/Release.key -O Release.key | |
apt-key add - < Release.key |
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
// Karma configuration file, see link for more information | |
// https://karma-runner.github.io/1.0/config/configuration-file.html | |
module.exports = function (config) { | |
config.set({ | |
basePath: '', | |
frameworks: ['jasmine', '@angular-devkit/build-angular'], | |
plugins: [ | |
require('karma-jasmine'), | |
require('karma-chrome-launcher'), |
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
// Protractor configuration file, see link for more information | |
// https://github.com/angular/protractor/blob/master/lib/config.ts | |
const { SpecReporter } = require('jasmine-spec-reporter'); | |
exports.config = { | |
allScriptsTimeout: 11000, | |
specs: [ | |
'./e2e/**/*.e2e-spec.ts' | |
], |
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
#!/bin/bash | |
if pgrep flite > /dev/null | |
then | |
killall flite | |
else | |
xsel | flite -voice /usr/share/tts-voices/cmu_us_ljm.flitevox | |
fi |
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
from tensorflow.compat.v1 import ConfigProto | |
from tensorflow.compat.v1 import InteractiveSession | |
config = ConfigProto() | |
config.gpu_options.per_process_gpu_memory_fraction = 0.6 | |
config.gpu_options.allow_growth = True | |
session = InteractiveSession(config=config) |
OlderNewer