This file contains hidden or 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
| #include <stdio.h> | |
| #include <stdlib.h> | |
| int power(int base, int n){ | |
| int p; | |
| for(p = 1; n > 0; n-- ){ | |
| p = p * base; | |
| } |
This file contains hidden or 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 bash | |
| if [[ "$OSTYPE" == "darwin"* ]] ; then | |
| if ! brew ls --versions pv &> /dev/null ; then | |
| echo "Pipe Viewer is NOT installed!" | |
| brew install pv | |
| fi | |
| else | |
| distro=$(source /etc/os-release && echo "$NAME"); |
This file contains hidden or 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
| import csv | |
| class CsvMapper(): | |
| """export database queries to csv""" | |
| def __init__(self, data): | |
| self.data = data | |
| self.headers = data['headers'] | |
| self.records = data['records'] | |
| def write_csv(self, destination): |
This file contains hidden or 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
| Description: | |
| Generates a basic rspec test template for rake after_party task | |
| Example: | |
| rails generate after_party_test 2019112233_your_task_name | |
| This will create: | |
| spec/lib/task/deploy/your_task_name_spec.rb |
This file contains hidden or 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 python | |
| from ffprobe import FFProbe | |
| import glob, os | |
| os.chdir("/downloads") | |
| for file in glob.glob("*.avi"): | |
| metadata=FFProbe(file) | |
| for stream in metadata.streams: | |
| if stream.isVideo(): |
This file contains hidden or 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 time import sleep | |
| import RPi.GPIO as GPIO | |
| from pygame import mixer | |
| mixer.init() | |
| alert = mixer.Sound('bell.wav') | |
| GPIO.setmode(GPIO.BOARD) | |
| button1 = 16 |
This file contains hidden or 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 | |
| # current Git branch | |
| branch=$(git symbolic-ref HEAD | sed -e 's,.*/\(.*\),\1,') | |
| # v1.0.0, v1.5.2, etc. | |
| versionLabel=v$1 | |
| # establish branch and tag name variables | |
| devBranch=develop |
This file contains hidden or 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
| live_loop :effects do | |
| with_fx :reverb, mix: 0.7, room: 0.5 do | |
| play 20, pan: -1 | |
| sleep 0.5 | |
| play 22, pan: 1 | |
| end | |
| end | |
| live_loop :prog do | |
| sample :bd_haus, rate: 2 |
This file contains hidden or 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
| axios.put(this.apiBaseEndpoint + '/' + id, input) | |
| .then((response) => { | |
| // Success | |
| }) | |
| .catch((error) => { | |
| // Error | |
| if (error.response) { | |
| // The request was made and the server responded with a status code | |
| // that falls out of the range of 2xx | |
| // console.log(error.response.data); |
This file contains hidden or 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
| import csv | |
| import sys | |
| f = open('filename.csv', "rt") | |
| reader = csv.reader(f) | |
| row_count = 0 | |
| for row in reader: | |
| if #do something with row get columns with row[index]: |
NewerOlder