Skip to content

Instantly share code, notes, and snippets.

View deven96's full-sized avatar
:shipit:
Too much to learn... so little time

Diretnan Domnan deven96

:shipit:
Too much to learn... so little time
View GitHub Profile
@deven96
deven96 / traffic-predict.ipynb
Last active May 15, 2019 17:21
Traffic Predict.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@deven96
deven96 / multidigitclassification.ipynb
Last active May 17, 2019 22:25
MultiDigitClassification
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@deven96
deven96 / Dockerfile
Created September 28, 2019 22:57 — forked from Irio/Dockerfile
GCP Serverless scrapers
FROM golang:1.12 as build
WORKDIR $GOPATH/src/github.com/Irio/wohnung
COPY scraper scraper
COPY main.go .
RUN go get -d -v ./...
RUN go install
FROM gcr.io/distroless/base
@deven96
deven96 / check_convex.py
Created December 23, 2019 11:17 — forked from mblondel/check_convex.py
A small script to get numerical evidence that a function is convex
# Authors: Mathieu Blondel, Vlad Niculae
# License: BSD 3 clause
import numpy as np
def _gen_pairs(gen, max_iter, max_inner, random_state, verbose):
rng = np.random.RandomState(random_state)
# if tuple, interpret as randn
@deven96
deven96 / checkOS.bash
Created March 19, 2021 12:13
Check OS
#!/bin/bash
function checkOS {
unameOut="$(uname -s)"
case "${unameOut}" in
Linux*) machine=Linux;;
Darwin*) machine=Mac;;
*) echo "Cannot run on unsupported machine ${unameOut}" && exit 1;
esac
@deven96
deven96 / addOneHour.bash
Last active March 19, 2021 12:20
Excuses with Bash
#!/bin/bash
function checkOS {
...
}
function addOneHourLinux {
date -d '+1 hour'
}
@deven96
deven96 / selectRandomExcuse.bash
Last active March 19, 2021 12:47
select a random excuse
#!/bin/bash
# Generate a random number using date
RANDOM=$(date +%s)
EXCUSESARRAY=(
"to visit Nosarobumeh in the hospital"
"for some away screen time"
"as I have a slight headache"
"to take a rest"
"for the next one hour"
"for a bit to run some errands"
@deven96
deven96 / slackUtility.bash
Created March 19, 2021 12:54
Slack related utilities
#!/bin/bash
# check if slack.sh exists else download it
# using curl
function checkSlackUtilityExists {
if [ -f "./slack.sh" ]; then
chmod +x ./slack.sh
else
echo -e "Downloading slack utility..." &&
curl -o ./slack.sh https://gist.githubusercontent.com/andkirby/67a774513215d7ba06384186dd441d9e/raw/c8a47aec0f08ca6dc64201ba40f09ff8c79f735e/slack.sh -s && chmod +x ./slack.sh &&
@deven96
deven96 / runIfWorkPeriod.bash
Last active March 19, 2021 12:56
Run command only if in work period
#!/bin/bash
# run function passed to this if we are in work period
# e.g runIfWorkPeriod echo "Hello there" will only
# output "Hello there" if currenttime is within work period
function runIfWorkPeriod {
start_time="09:00"
end_time="17:00"
currenttime=$(date +%H:%M)
if [[ "$currenttime" > "$start_time" ]] && [[ "$currenttime" < "$end_time" ]]; then
@deven96
deven96 / screenActiveMac.bash
Last active March 19, 2021 12:59
Checking screen is active on Mac
#!/bin/bash
# $screenActive=1 means the screen is active and O is inactive
# View the explanation of the CGSession dictionary at
# https://stackoverflow.com/questions/11505255/osx-check-if-the-screen-is-locked
function checkScreenActiveMac {
python -c 'import sys,Quartz;\
d=Quartz.CGSessionCopyCurrentDictionary();\
sys.exit(d and \
d.get("CGSSessionScreenIsLocked", 0) == 0 and \