Skip to content

Instantly share code, notes, and snippets.

Avatar
🚀
Gone phishing

Kartik Talwar KartikTalwar

🚀
Gone phishing
View GitHub Profile
@KartikTalwar
KartikTalwar / RPMpackages.rb
Last active Jun 29, 2016
Create puppet facts for RPM packages
View RPMpackages.rb
package_data = Facter::Util::Resolution.exec('rpm --query --all --qf "%{NAME}||%{VERSION}\n"')
package_data.split("\n").each do |line|
rpm_detail = line.split("||")
package_name = 'package_' + rpm_detail[0]
package_version = rpm_detail[1]
Facter.add(package_name) do
setcode do
View app.config
%% -*- mode: erlang;erlang-indent-level: 4;indent-tabs-mode: nil -*-
%% ex: ft=erlang ts=4 sw=4 et
[
%% Riak Client APIs config
{riak_api, [
%% pb_backlog is the maximum length to which the queue of pending
%% connections may grow. If set, it must be an integer >= 0.
%% By default the value is 5. If you anticipate a huge number of
%% connections being initialised *simultaneously*, set this number
%% higher.
View vm.args
## Name of the riak node
-name riak@127.0.0.1
## Cookie for distributed erlang. All nodes in the same cluster
## should use the same cookie or they will not be able to communicate.
-setcookie riak
## Heartbeat management; auto-restarts VM if it dies or becomes unresponsive
## (Disabled by default..use with caution!)
##-heart
View ap.php
<?php
$key = ''; // enter your api key here
function getLocations($key)
{
$url = "http://api.uwaterloo.ca/public/v1/?key=$key&service=APLocations";
$get = file_get_contents($url);
View TheMatrix.html
<body style=margin:0><canvas id=q /><script>var q=document.getElementById('q'),s=window.screen,w=q.width=s.width,h=q.height=s.height,p=Array(256).join(1).split(''),c=q.getContext("2d"),m=Math,r=m.random;setInterval(function(){c.fillStyle="rgba(0,0,0,0.05)";c.fillRect(0,0,w,h);c.fillStyle="rgba(0,255,0,1)";p=p.map(function(v,i){c.fillText(String.fromCharCode(m.floor(2720+r()*33)),i*10,v);v+=10;if(v>768+r()*10000)v=0;return v})},33)</script>
View gist:5080747
parser = argparse.ArgumentParser(description='Generic API')
parser.add_argument('--name', dest='name', help='full name')
parser.add_argument('--token', dest='fbtoken', help='firebase token')
args = parser.parse_args()
name = args.name
firebase = args.fbtoken
fname, lname = name.split()
View packages.pp
package { 'Droplr':
source => 'https://droplr.com/download/mac',
provider => 'compressed_app'
}
package { 'Alfred':
provider => 'compressed_app',
source => 'http://cachefly.alfredapp.com/alfred_1.3.3_267.zip'
}
@KartikTalwar
KartikTalwar / CoderDojo.md
Last active Aug 1, 2018
GitHub CoderDojo - Intro to D3.js
View CoderDojo.md

Animations in JavaScript

D3.js

Library that uses HTML, CSS and SVG to bring data to life.

Setting Up

View scheduledump.json
{
"response":{
"meta":{
"Requests":"0",
"Timestamp":"2013-02-12T22:55:04-05:00",
"Status":"200",
"Message":"OK",
"Version":"1.4b7"
},
"data":{
View float_int.py
# Function recreating the functionality of float() and int() in Python.
# By Neil Fraser. Public Domain. 2012.
def myFloat(input = 0.0):
if type(input) != str:
if type(input) == bool:
return input and 1.0 or 0.0
if type(input) == float:
return input
if type(input) in (int, long):