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
| 'use strict'; | |
| var GitHub = require('github-api'); | |
| var fetch = require('node-fetch'); | |
| var exec = require('child_process').exec; | |
| const gh = new GitHub({ token: 'MY_TOKEN' }); | |
| const org = gh.getOrganization('MY_ORG'); | |
| fetch('https://api.bitbucket.org/2.0/teams/MY_ORG/repositories') |
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
| package main | |
| import ( | |
| "io/ioutil" | |
| "log" | |
| "net/http" | |
| "os" | |
| "strings" | |
| ) |
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
| package main | |
| import ( | |
| "log" | |
| "time" | |
| ) | |
| type Process struct { | |
| quit chan struct{} | |
| } |
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 unittest | |
| def winner(hand1, hand2): | |
| hand1 = sorted(hand1, reverse=True) | |
| hand2 = sorted(hand2, reverse=True) | |
| result = try_winner([four_of_a_kind, full_house, straight, three_of_a_kind, | |
| two_pairs, pair], hand1, hand2) | |
| if result != 0: |
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 | |
| # | |
| # eg. ./reboot.sh 192.168.1 | |
| for ip in $1.{1..254}; do | |
| curl "http://$ip:1400/reboot" -m 2 2>/dev/null & | |
| done |
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
| git clone https://github.com/hawx/evmpd | |
| cd evmpd | |
| sudo apt-get install libmpdclient-dev | |
| wget http://mirror.ox.ac.uk/sites/archive.raspbian.org/archive/raspbian/pool/main/libe/libevdev/libevdev-dev_1.3+dfsg-1_armhf.deb | |
| sudo apt-get install libjs-jquery # WHAT? | |
| sudo dpkg -i libevdev-dev_1.3+dfsg-1_armhf.deb | |
| make |
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
| grep 'http[^, ]*' *.txt | sed -ne 's/.*\(http[^, ]*\).*/\1/p' | sort | uniq -c | sort -r -t ' ' > counts.txt |
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
| class Object | |
| # A method that adds a #subclass class method allowing | |
| # you to find the subclasses of a particular class. | |
| # | |
| # @example | |
| # | |
| # class String2 < String; end | |
| # class String3 < String; end | |
| # String.subclasses |
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
| # Sometimes you want to run a set of blocks before/after | |
| # each/all of something. Problem solved. | |
| # | |
| # @example | |
| # | |
| # class CountDown < Runner | |
| # before :all do |arr| | |
| # arr.collect {|i| i + 1 } | |
| # end | |
| # |
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
| # @param args [Hash{Symbol=>Object}] | |
| def run_proc_with_locals(args, proc) | |
| k = Class.new | |
| args.each do |sym, v| | |
| k.send(:define_method, sym) { v } | |
| end | |
| k.new.instance_exec(&proc) | |
| end | |
| tha_proc = proc do |