Skip to content

Instantly share code, notes, and snippets.

View udnaan's full-sized avatar
🌎
Thriving

Adnan Yunus udnaan

🌎
Thriving
View GitHub Profile
@udnaan
udnaan / add_to_context_menu.bat
Created March 30, 2015 02:04
A batch file to add sublime text 3 poartable to context menu
@echo off
set st3=d:\downloads\software\sublimeText3\sublime_text.exe
rem Add to file/*
@reg add "HKEY_CLASSES_ROOT\*\shell\Edit with Sublime Text 3" /t REG_SZ /v "" /d "Edit" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Edit with Sublime Text 3" /t REG_EXPAND_SZ /v "Icon" /d "%st3%,0" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Edit with Sublime Text 3\command" /t REG_SZ /v "" /d "%st3% \"%%1\"" /f
rem Add to Dir/*
@reg add "HKEY_CLASSES_ROOT\Folder\shell\Open with Sublime Text 3" /t REG_SZ /v "" /d "Open In ST3" /f
@udnaan
udnaan / ftp.py
Last active August 29, 2015 14:23
Python script to ftp a file
import ftplib
import plac
def main(server, user, password, filepath, port=21):
ftp = ftplib.FTP()
ftp.connect(server, int(port))
ftp.login(user, password)
print(ftp.getwelcome())
file = open(filepath, 'rb') # file to send
@udnaan
udnaan / openssl_cross_compile.md
Last active June 24, 2024 00:54
How to cross compile Openssl 1.1.0 for Windows Host on Ubuntu 14.04 LTS

Install mingw tools on linux:

sudo apt-get install mingw-w64

clone openssl repo:

git clone https://github.com/openssl/openssl.git

Configure openssl for cross compile:

@udnaan
udnaan / torch_activate.fish
Last active March 13, 2018 16:37
Fish shell torch-activate fucntion
function torch_activate
set -gx LUA_PATH '/Users/nan/.luarocks/share/lua/5.1/?.lua;/Users/nan/.luarocks/share/lua/5.1/?/init.lua;/usr/local/share/lua/5.1/?.lua;/usr/local/share/lua/5.1/?/init.lua;/Users/nan/p/torch/install/share/lua/5.1/?.lua;/Users/nan/p/torch/install/share/lua/5.1/?/init.lua;./?.lua;/Users/nan/p/torch/install/share/luajit-2.1.0-beta1/?.lua'
set -gx LUA_CPATH '/Users/nan/.luarocks/lib/lua/5.1/?.so;/usr/local/lib/lua/5.1/?.so;./?.so;/Users/nan/p/torch/install/lib/lua/5.1/?.so;/usr/local/lib/lua/5.1/loadall.so'
set -gx PATH /Users/nan/p/torch/install/bin $PATH
set -gx LD_LIBRARY_PATH /Users/nan/p/torch/install/lib $LD_LIBRARY_PATH
set -gx DYLD_LIBRARY_PATH /Users/nan/p/torch/install/lib $DYLD_LIBRARY_PATH
set -gx LUA_CPATH '/Users/nan/p/torch/install/lib/?.dylib;'$LUA_CPATH
end
@udnaan
udnaan / config.fish ssh
Last active June 21, 2016 21:45
fish_config
if not set -q $SSH_TTY
test -e {$HOME}/.iterm2_shell_integration.fish ; and source {$HOME}/.iterm2_shell_integration.fish
end
@udnaan
udnaan / .eslintrc.json
Created August 2, 2016 21:12
eslint config
{
"env": {
"browser": true,
"es6": true,
"node": true
},
"extends": "eslint:recommended",
"parserOptions": {
"sourceType": "module",
"ecmaFeatures": {
@udnaan
udnaan / vimrc
Created November 12, 2016 02:04
.vimrc
set clipboard=unnamed
set shell=bash
syntax on
set nocompatible " be iMproved, required
filetype off " required
filetype plugin indent on
" show existing tab with 4 spaces width
set tabstop=4
" " when indenting with '>', use 4 spaces width
const functions = require('firebase-functions');
const admin = require('firebase-admin');
const {credentials} = functions.config().auth;
credentials.private_key = credentials.private_key.replace(/\\n/g, '\n');
const config = Object.assign({}, functions.config().firebase, {credentials});
admin.initializeApp(config);
const gcs = require('@google-cloud/storage')({credentials});
const dns = require('@google-cloud/dns')({credentials});
const zoneName = 'applambda';
const zone = dns.zone(zoneName);
@udnaan
udnaan / gnome_change_workspace.py
Last active September 2, 2018 03:29
Changes workspace on a gnome desktop (i.e Ubuntu). Written to be able to switch workspace while running vnc/remote desktop in fullscreen
#!/usr/bin/env python3
# Documentation for Wnck is at http://lazka.github.io/pgi-docs/#Wnck-3.0/classes/Workspace.html#Wnck.Workspace.get_number
# Documentation for keyboard is at https://github.com/boppreh/keyboard
import keyboard as kb
import gi
gi.require_version('Wnck', '3.0')
from gi.repository import Wnck, Gtk
@udnaan
udnaan / decode.js
Created September 22, 2018 00:51
Decode devices from a rooted device for tuya smart life app
const fs = require('fs');
const path = require('path');
const xml2js = require('xml2js');
const data = fs.readFileSync(path.join(__dirname, process.argv[2]), {encoding: 'UTF-8'});
xml2js.parseString(data, (err, result) => {
const str = result.map.string[6]._;
console.log(str);