Skip to content

Instantly share code, notes, and snippets.

View arslnb's full-sized avatar
🎷
jamming

Arsalan Bashir arslnb

🎷
jamming
View GitHub Profile
@arslnb
arslnb / file.r
Last active November 2, 2018 17:33
# Import the libraries
library(zoo)
library(dplyr)
Dataset <- Dataset %>% group_by(PermNo)
Dataset <- mutate(Dataset, cumRet = (((Price/lag(Price, n=12, order_by = Month))-1)))
top <- Dataset[Dataset$ME >= Dataset$BP_ME,]
top <- top[!(top$Month<="Dec 1990"),]
bottom <- Dataset[Dataset$ME < Dataset$BP_ME,]
<div class="ui secondary menu purple-menu">
<div class="ui container">
<a class="fitted item">
Scoot
</a>
<div class="right menu">
<a class="item" href="/discover">
Discover
</a>
<a class="item" href="/host">
@arslnb
arslnb / code.js
Created July 20, 2017 10:11
OpenAsync issue code
Realm.Sync.User.login('http://<SERVER-IP>:9080', <USERNAME>, <PASSWORD>, (error, user) => {
if(!error){
Realm.openAsync({
schema: [SomeSchema],
sync: {
user: user,
url: 'realm://<SERVER-IP>:9080/data'
}}, (error, realm) => {
if (error) {
}
@arslnb
arslnb / passLock.ino
Created June 7, 2017 10:38
16x2 LCD and 4X4 Keypad unlock for Arduino
#include <Wire.h>
#include <LiquidCrystal.h>
#include <SoftwareSerial.h>
#include <Keypad.h>
#define redLED 13
#define greenLED 10
#define relayPIN 12
String password = "2468";
import webbrowser
from oauth2client import client
client_id_file = "client_id.json"
flow = client.flow_from_clientsecrets(client_id_file, scope='https://www.googleapis.com/auth/analytics.readonly', redirect_uri='urn:ietf:wg:oauth:2.0:oob')
auth_uri = flow.step1_get_authorize_url()
# Open a browser window to manually authenticate and get the auth code
webbrowser.open(auth_uri)
auth_code = raw_input('Enter the authorization code: ')
@arslnb
arslnb / logger.py
Created September 18, 2015 10:40
Script to make log files for NIT Srinagar Internships 2015
import sys
names = ["name1", "name2"]
def write():
print('Creating log files...')
for name in names:
file_name = name + '.txt'
@arslnb
arslnb / gmail
Created November 14, 2012 12:49
Sending emails via GMAIL
def mail():
#Imports the module
import smtplib
fromaddr = 'example_one@gmail.com'
toaddrs = 'example_two@gmail.com'
msg = "Sent via python"
# Authentication
@arslnb
arslnb / gist:4071898
Created November 14, 2012 12:44
Minimum pin consuming LCD display
void commandProcessor(void) {
int lastCounts;
int counts;
boolean firstCount = true;
if (Encoder.buttonDown()) { // Read push button status (Ground true => 0=down)
while (Encoder.buttonDown()); // Do nothing while button is depressed
// Display menu
LCD.printString(MSG_FCT_SELECT, 1);
counts = 0;
Encoder.setCounter(counts, 0, 3);
@arslnb
arslnb / gist:4071764
Created November 14, 2012 12:05
Fetching site data via PHP
<html>
<body>
<?php
function getFeed($feed_url) {
$content = file_get_contents($feed_url);
@arslnb
arslnb / get_access_token.py
Created November 14, 2012 11:55
Python Wrapper around Twitter API
import os
import sys
try:
from urlparse import parse_qsl
except:
from cgi import parse_qsl
import oauth2 as oauth