Skip to content

Instantly share code, notes, and snippets.

View nirlanka's full-sized avatar

Nir Lanka nirlanka

  • SGX
  • Singapore
View GitHub Profile
@nirlanka
nirlanka / minimal-test.cs
Last active November 16, 2019 19:17
SublimeText3 CSharp runner and builder for Linux and OS X using installed Mono development environment
using System;
class Test
{
static void Main()
{
Console.WriteLine("Hello Sublime");
}
}
@nirlanka
nirlanka / html-structure.html
Created October 17, 2019 08:46
Add this style to any web page's header through dev-tools to see the structure of the layout.
<style>body * { background-color: rgba(0,0,100, .2) !important; outline: rgba(0,100,0, .2) !important; }</style>
@nirlanka
nirlanka / lisp-like.js
Last active September 14, 2019 14:13
A simple lisp-like language/interpreter written in pure javascript, using javascript arrays, without any dependencies. UPDATE: I'll be continuing work on this repository: https://github.com/nirlanka/ao
(function () {
const __inp = `
((defun foo (a b)
(* a b))
(print (foo 2 3))
(defun bar (a b c) (foo
(foo a b)
c))
(print (bar 4 5 6))
@nirlanka
nirlanka / password-cracker.py
Created August 7, 2019 16:30
Answer to Hackerrank challenge "Password Cracker", which is correct, but not the expected answer in some test cases ¯\_(ツ)_/¯ (https://www.hackerrank.com/challenges/password-cracker/forum)
#!/bin/python3
DEBUG = False
import math
import os
import random
import re
import sys
#!/bin/python3
DEBUG = False
import os
import sys
def trie_find(node, path):
if not node.get(path[0]):
return 0
@nirlanka
nirlanka / create-angular-light.sh
Last active July 25, 2019 10:05
Create quick light Angular project
$appname="one"
ng new $appname --prefix=$appname --enableIvy=true --inlineStyle=true --inlineTemplate=true --skipTests=true --routing=true --skipInstall=true --style=sass
@nirlanka
nirlanka / install-apps.ps1
Last active July 13, 2019 07:01
Install dev-env for MicroBuild
# Install Chrome
choco install googlechrome -y
# Install Slack
choco install slack -y
# Install other packages
choco install nvm -y
# Install NodeJS
@nirlanka
nirlanka / extract-packages.py
Created July 5, 2019 13:14
Extract package details from .NET or NodeJS projects
## Usage:
## python(3) .\extract-packages.py filename.ext::filename2.ext
import sys
import subprocess
import json
import requests
def log(txt, line_end='\n'):
outfile = open('extract-packages.log.txt', 'a')
@nirlanka
nirlanka / click-to-copy-cell.js
Created May 13, 2019 12:55
Click to copy text (from table cell) in HTML with pure Javascript
const copyToClipboard = str => {
const el = document.createElement('textarea');
el.value = str;
document.body.appendChild(el);
el.select();
document.execCommand('copy');
document.body.removeChild(el);
};
document.addEventListener('click', (e) => {
@nirlanka
nirlanka / mobileconfig.json
Created April 9, 2019 08:53
MicroBuild Management Mobile - test 1
{
"//0.0.1": "http://localhost:59659/",
"0.0.1": "http://192.168.137.1:59659/"
}