Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View jjasghar's full-sized avatar

JJ Asghar jjasghar

View GitHub Profile

Making a Reddit Upvote Notifier

The Arduino Yún's ability to connect to the Internet introduces many new possibilities to traditional Arduino development, such as capturing data from the web and making use of it inside of a sketch.

This project will demonstrate this ability by monitoring the number of upvotes accrued by a Reddit comment thread and alerting the user when new upvotes are added.

Many companies offer application programming interfaces (APIs, for short) that allow third-party programs to access their data. Reddit, for example, provides an API that gives detailed information and statistics for posts, comment threads, and users.

This project uses a Python script on the Yun's Linux side to read the current upvote count from a comment thread using Reddit's API. A skech running on the Arduino side will track this number and display a notification message on an LED matrix every time a new vote is added.

Simple journal with vim

So how would you use your text editor to make a day notes?

For vim I end up using simple approach:

  • have a ~/docs/journal/ directory where I keep yearly journals in asciidoc format (one can use markdown of course).

  • have a mapping to quickly open a journal ready to enter you thoughts, notes or a todos for a day.

@jjasghar
jjasghar / nat.sh
Created September 22, 2016 00:18
basic nat setup with iptables with default OpenVPN network
#!/bin/bash
iptables -F
iptables -t nat -F
iptables -P INPUT ACCEPT
iptables -P OUTPUT ACCEPT
iptables -P FORWARD DROP
export LAN=ens160 #change to your nic
export WAN=ens192 #change to your nic
@jjasghar
jjasghar / secret.rb
Created April 26, 2017 17:12 — forked from sethvargo/secret.rb
Example Chef extension to extract secrets from HashiCorp's Vault
# Please see the following blog post for more information:
#
# https://www.hashicorp.com/blog/using-hashicorp-vault-with-chef.html
#
resource_name :vault_secret
property :path, String, name_property: true
property :destination, String
@jjasghar
jjasghar / .zshrc
Created August 19, 2019 20:49 — forked from ahmadawais/.zshrc
Print status for all fail2ban jails.
# Print status for all fail2ban jails.
function f2bstall() {
JAILS=($(fail2ban-client status | grep "Jail list" | sed -E 's/^[^:]+:[ \t]+//' | sed 's/,//g'))
for JAIL in ${JAILS[@]}
do
echo "--------------- 👀 JAIL STATUS: $JAIL ... ---------------"
fail2ban-client status $JAIL
echo "--------------- ... ---------------"
done
}
@jjasghar
jjasghar / vmware_chef.md
Created September 13, 2016 22:26 — forked from swalberg/vmware_chef.md
VMware and Chef Tools

VMware and Chef tools

Chef and VMware are a natural pairing and there are several tools available to enhance the integration.

Knife is a command-line tool that provides an interface between a local chef-repo and the Chef server and allows you to manipulate objects on the Chef server. Knife plugin allows your computer to talk to a 3rd party systems like vSphere or vRA. A plugin can create a VM in vSphere and then bootstrap it with Chef, for example, or it can expose your vRa catalog to your workstation so you don't need to use a GUI.

The following are the main interfaces with VMware and Chef our "knife" plugins.

@jjasghar
jjasghar / gist:2aac4679bc00964eaf98f919d89c2f82
Created February 1, 2018 19:50 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@jjasghar
jjasghar / app.rb
Last active November 5, 2017 20:24
salute to service twitter.rb
require "net/http"
require "uri"
require 'twitter'
# Create an app.twitter.com fill these out
client = Twitter::REST::Client.new do |config|
config.consumer_key = "FAKE"
config.consumer_secret = "VERYFAKEz2eQsYnUNXVL7S0kF0Bzh"
config.access_token = "SOMENUMEBRE-66oauaoeu"
raise "Missing parameter 'CRED_PATH'. Please read docs at #{__FILE__}" \
unless ENV.key?('CRED_PATH')
my_project = "jj-test-kitchen"
gauth_credential 'mycred' do
action :serviceaccount
path ENV['CRED_PATH'] # e.g. '/path/to/my_account.json'
scopes [
'https://www.googleapis.com/auth/compute'