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 Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
module("resty.consul", package.seeall) | |
_VERSION = '0.1.0' | |
function service_nodes(service) | |
local http = require "resty.http" | |
local json = require "cjson" | |
local hc = http:new() | |
local upstream = "" |
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
{ | |
\"text\": \"RELEASE has been released at URL \", | |
\"channel\": \"#CHANNEL\", | |
\"username\": \"USERNAME\", | |
\"icon_emoji\": \"EMOJI\" | |
} |
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
ref_file=GOPR3440.MP4 | |
new_time_for_that_file=0327160015 #date's format: 27th March 2015, 16:00 | |
ref_file_timestamp=`stat -f %B -t %s "$ref_file"` | |
new_time_timestamp=`date -j $new_time_for_that_file +%s` | |
time_diff=$[$new_time_timestamp - $ref_file_timestamp] | |
for f in *; do | |
old=$(stat -f %B -t %s "$f") | |
new=$(date -r $(($old + $time_diff)) '+%m/%d/%Y %H:%M:%S') |
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
android { | |
.... | |
defaultConfig { | |
... | |
versionCode 3 | |
versionName versionCode + "-" + getTimestamp() | |
} | |
... | |
... | |
applicationVariants.all { variant -> |
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 | |
# --------------------------------------------------- | |
# Original script name: kill9 | |
# | |
# Object: Kill the matching given name processes | |
# --------------------------------------------------- | |
if [ -z $1 ]; then | |
echo "Error: missing search arguments... exiting" |
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
# first, log in | |
bundle exec travis login | |
# wanna see the token ? | |
bundle exec travis token | |
# check that this token tokens | |
curl -H "Authorization: token $(bundle exec travis token)" https://api.travis-ci.org/users/ | |
# Works ????? |
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
sql='select event_type as code, country, state, location, name from tracks group by code, country, state, location, name order by code, country, state, location, name;' | |
pg_res = ActiveRecord::Base.connection.execute(sql) | |
csv_file = CSV.generate do |csv| | |
csv << %w{code country state location name} | |
pg_res.values.each { |line| csv << line } | |
end | |
File.write('tmp/tracks_export.csv', csv_file) |
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 Foo | |
def self.showConstant | |
puts CONSTANT | |
end | |
end | |
class SubFoo < Foo | |
CONSTANT='SubFoo string' | |
end | |
SubFoo.showConstant |
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 | |
exit_code=0 | |
tests=' | |
echo -n "MemCache service listening... "; netstat -l | grep "memcache.*LISTEN" > /dev/null 2>&1 | |
echo -n "App returning Set-Cookie: XRSF-TOKEN header... "; curl -I localhost 2>/dev/null | grep "Set-Cookie: XSRF-TOKEN" > /dev/null | |
echo -n "App /status return 200... "; curl --connect-timeout 1 localhost/status > /dev/null 2>&1 | |
' | |
IFS=$'\n' |