Skip to content

Instantly share code, notes, and snippets.

View moski's full-sized avatar

Moski Doski moski

View GitHub Profile
@moski
moski / example2.js
Created June 5, 2018 11:30
example gist
var request = require("request");
var options = {
method: 'POST',
url: 'https://trackcmp.net/event',
headers: {
//Add Headers here if needed
},
form: {
actid: 23033,
key: "c12973b078007927842301eff932e7d78b74b3e",
var request = require("request");
var options = {
method: 'POST',
url: 'https://trackcmp.net/event',
headers: {
//Add Headers here if needed
},
json: {
actid: 23033,
key: "c12973b078007927842301eff932e7d78b74b3e",
@moski
moski / before_symlink.rb
Last active January 10, 2018 17:18
How to integrate rollbar with AWS opsworks
@moski
moski / nginx.conf
Last active August 29, 2015 14:18
Nginx MYSQL PHP Configuration
worker_processes 1;
error_log /usr/local/etc/nginx/logs/error.log debug;
events {
worker_connections 1024;
}
http {
include mime.types;
twitter_client.filter(track: hashtags.join(",")) do |tweet|
# Only Fetch tweets objects and ignore all retweets
if tweet.is_a?(Twitter::Tweet) && !tweet.retweet?
# only fetch tweets with images.
if tweet.media?
tweet_respresenter = Storage::Tweet.new.extend(TweetRepresenter).from_json(tweet.to_json)
tweet_respresenter.save!($redis)
print '.'
end
[base]
name=CentOS-$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=
$basearch&repo=os
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
priority=1
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import requests
text = u'這是一封測試簡訊 This a test SMS.'
endpoint = 'https://rest.nexmo.com/sms/json'
data = {
'username': '{yours}',
'password': '{yours}',
@moski
moski / fatooosh.json
Created July 7, 2013 14:06
Fatooosh sample JSON response
{
"apiVersion": "1.0",
"data": {
"_id": "51cbe9e4f92f58b477000003",
"created_at": "2013-06-27T10:29:40+03:00",
"description": "My Drunk Kitchen",
"title": "My Drunk Kitchen",
"updated_at": "2013-06-27T10:29:40+03:00",
"items": [{
"video": {
@moski
moski / num_of_odd_numbers.rb
Created May 20, 2012 17:18
Return the number of odd numbers preceding a given number
# Return the number of odd numbers preceding a given number
# usage:
# puts Numberofoddnumbers::get(num)
# puts Numberofoddnumbers::get(num, 7) # will get all the odd numbers until 7
#
# blog post http://blog.moski.me/2012/05/drawing-hearts-in-ruby.html
#
module Numberofoddnumbers
def self.get(number, start_from=1)
sum = 0
@moski
moski / heart.rb
Created May 20, 2012 16:57
draw a heart in ruby
# Draw a heart in ruby
# blog post http://blog.moski.me/2012/05/drawing-hearts-in-ruby.html
#
puts [[2,2],9,9,7,5,3,1].map{|t|[*t].map{|n|"*"*n}.join(" ").center(9)}