Skip to content

Instantly share code, notes, and snippets.

View kssd's full-sized avatar

Kunwar Sangram Singh kssd

  • India
View GitHub Profile
@kssd
kssd / UTF8Check.java
Created May 16, 2023 11:14
JAVA : Check UTF8 enconded characters in a string
import java.util.*;
import java.util.stream.*;
import java.nio.charset.StandardCharsets;
public class UTF8Check {
public static final String[] utf8Strings = new String[]{
"UTF8 check",
"@!#$%^&*()_+}{[]';:/.,?><`~1234567890-=\\|"
};
# Run Following command to remove com.apple.qurantine flag from jdk install dir
# IMP: replace <version> to installed version eg. 14 for java 14
sudo xattr -d com.apple.quarantine $(/usr/libexec/java_home <version>)/../..
@kssd
kssd / gd_rss.md
Last active July 3, 2019 19:34
Python n-dim Residual sum of squares.

Gradient descent - Computing r_squared (residual sum of squares):

import numpy as np
from scipy.optimize import curve_fit

x = np.arange(1, 11, 1)
y = x + 10;

def lin_mod(x, a , b): return x*a + b
@kssd
kssd / oreilly-open-ebooks-download.sh
Created June 10, 2017 11:36
oreilly free ebooks
#!/bin/bash
# PDF downloads
wget http://www.oreilly.com/programming/free/files/modern-java-ee-design-patterns.pdf
wget http://www.oreilly.com/programming/free/files/object-oriented-vs-functional-programming.pdf
wget http://www.oreilly.com/programming/free/files/java-the-legend.pdf
wget http://www.oreilly.com/programming/free/files/introducing-java-8.pdf
wget http://www.oreilly.com/programming/free/files/a-whirlwind-tour-of-python.pdf
wget http://www.oreilly.com/programming/free/files/20-python-libraries-you-arent-using-but-should.pdf
wget http://www.oreilly.com/programming/free/files/hadoop-with-python.pdf
@kssd
kssd / maker.conf
Created April 20, 2016 09:31
/etc/maker.conf: enable java 8 on freeBSD
JAVA_VENDOR=openjdk
JAVA_VERSION=1.8
BOOTSTRAPJDKDIR=/usr/local/openjdk8
JAVA_PREFERRED_PORTS=JAVA_PORT_NATIVE_OPENJDK_JDK_1_8
@kssd
kssd / loader.conf
Created April 20, 2016 06:47
FreeBSD 8.4 /boot/loader.conf - Disable boot menu
beastie_disable="YES"
autoboot_delay="-1"
git diff --no-prefix --ignore-space-at-eol | sed -e "s/^diff --git [^[:space:]]*/Index:/" -e "s/^index.*/===================================================================/" > changes.patch
@kssd
kssd / fixNPTOpenJDK.sh
Created July 23, 2014 13:15
Fix for "NPT open error" problem on FreeBSD for Java Remote Debugging
#!/bin/sh
# For FreeBSD + OpenJDK
ln -s /usr/local/openjdk7/jre/lib/amd64/libnpt.so /usr/local/lib/libnpt.so
#!/bin/bash
# Error msg : 'xterm': unknown terminal type.
# Target : Ubuntu
sudo apt-get install -y ncurses-term
sudo ln -s /lib/terminfo/x/xterm /usr/share/terminfo/x/xterm