Skip to content

Instantly share code, notes, and snippets.

View karthikeyan5's full-sized avatar
🏁
Get things done!

Karthikeyan S karthikeyan5

🏁
Get things done!
  • Tiruppur, India
  • 10:09 (UTC +05:30)
View GitHub Profile
@lsauer
lsauer / parseInt.py
Last active April 3, 2022 09:11
Python: JavaScript like parseInt function in one line
#lsauer.com, 2013
#Note: -)for convenience the function uses the re-module, but can be rewritten to fit into a lambda expression
# -)choose any other, more-expressive return type such as NumPy's `nan` over None if you like
#demonstrative-version:
def parseInt(sin):
import re
return int(''.join([c for c in re.split(r'[,.]',str(sin))[0] if c.isdigit()])) if re.match(r'\d+', str(sin), re.M) and not callable(sin) else None
#via a simple regex:
@rob-murray
rob-murray / add_intellij_launcer
Last active July 16, 2024 23:43
Add Intellij launcher shortcut and icon for ubuntu
// create file:
sudo vim /usr/share/applications/intellij.desktop
// add the following
[Desktop Entry]
Version=13.0
Type=Application
Terminal=false
Icon[en_US]=/home/rob/.intellij-13/bin/idea.png
Name[en_US]=IntelliJ
@tresf
tresf / connectAndPrint.js
Last active December 10, 2021 10:04
Connect and print
function connectAndPrint() {
// our promise chain
connect().then(function() {
return print();
}).then(function() {
success(); // exceptions get thrown all the way up the stack
}).catch(fail); // so one catch is often enough for all promises
// NOTE: If a function returns a promise, you don't need to wrap it in a fuction call.
// The following is perfectly valid:
@guillaumevincent
guillaumevincent / README.md
Last active June 23, 2024 23:59
Windows Service with Python 3.5 and pyinstaller
@karthikeyan5
karthikeyan5 / GSTINValidator.java
Last active April 2, 2022 14:33
GSTIN Validator with checksum validation (Java,Python)
// from http://developer.gstsystem.co.in/apiportal/howToStart/download
package org.gst.poc.util;
import java.util.Scanner;
public class GSTINValidator {
public static final String GSTINFORMAT_REGEX = "[0-9]{2}[a-zA-Z]{5}[0-9]{4}[a-zA-Z]{1}[1-9A-Za-z]{1}[Z]{1}[0-9a-zA-Z]{1}";
public static final String GSTN_CODEPOINT_CHARS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
public static void main(String args[]) {