Skip to content

Instantly share code, notes, and snippets.

View ragnarok22's full-sized avatar
🏠
Working from home

Reinier Hernández ragnarok22

🏠
Working from home
View GitHub Profile
@ragnarok22
ragnarok22 / anagrams.py
Created November 1, 2022 16:59
Determine if two words are anagrams
def is_anagram(word1: str, word2: str) -> bool:
"""Determine if two words are anagram
:param word1: word to check if is an anagram
:param word2: word to check if is an anagram
:return: True whether the words are anagram or False otherwise
"""
if word1 == word2:
return True
elif len(word1) != len(word2):
@ragnarok22
ragnarok22 / setproxy.sh
Created January 26, 2022 15:02
Set system proxy in Linux
#!/bin/bash
# CONSTANTS
# In case your proxy is without user and password just replace this line with
# HTTP:_PROXY="http://host:port"
# host is the proxy host. Ex: proxy.example.com or 192.168.1.50
# port is the proxy port. Ex: 3128 or 8080
HTTP_PROXY="http://user:password@host:port"
HTTPS_PROXY=$HTTP_PROXY

Keybase proof

I hereby claim:

  • I am ragnarok22 on github.
  • I am ragnarok22 (https://keybase.io/ragnarok22) on keybase.
  • I have a public key whose fingerprint is ED67 71E0 58A1 FEEB E6A7 125F 2734 2BCD EEC2 FC48

To claim this, I am signing this object:

@ragnarok22
ragnarok22 / debug.css
Created July 31, 2019 14:58
Debug style for debugging html elements. Eg: <body debug></body>
/*! debug.css | MIT License | https://gist.github.com/zaydek/6b2e55258734deabbd2b4a284321d6f6 */
[debug], [debug] *:not(g):not(path) {
color: hsla(210, 100%, 100%, 0.9) !important;
background: hsla(210, 100%, 50%, 0.5) !important;
outline: solid 0.25rem hsla(210, 100%, 100%, 0.5) !important;
box-shadow: none !important;
filter: none !important;
}
395 INFO: PyInstaller: 3.3.1
395 INFO: Python: 3.6.3
396 INFO: Platform: Windows-10-10.0.16299-SP0
401 INFO: wrote D:\Ragnarok\projects\Web\paraDaniel\main.spec
405 INFO: UPX is not available.
424 INFO: Extending PYTHONPATH with paths
['D:\\Ragnarok\\projects\\Web\\paraDaniel',
'D:\\Ragnarok\\projects\\Web\\paraDaniel']
425 INFO: checking Analysis
425 INFO: Building Analysis because out00-Analysis.toc is non existent
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Deep Learning integration for JCLAL Framework 1.1
[INFO] ------------------------------------------------------------------------
Downloading from libs: file://D:\Ragnarok\projects\Java\JCLAL\jclal-deeplearning/libs/nz/ac/waikato/cms/weka/weka-dev/maven-metadata.xml
Downloading from central: https://repo.maven.apache.org/maven2/nz/ac/waikato/cms/weka/weka-dev/maven-metadata.xml
Downloading from sonatype-nexus-snapshots: https://oss.sonatype.org/content/repositories/snapshots/nz/ac/waikato/cms/weka/weka-dev/maven-metadata.xml
Downloaded from central: https://repo.maven.apache.org/maven2/nz/ac/waikato/cms/weka/weka-dev/maven-metadata.xml (682 B at 187 B/s)
Downloading from central: https://repo.maven.apache.org/maven2/nz/ac/waikato/cms/weka/multiInstanceFilters/maven-metadata.xml
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] JCLAL framework
[INFO] jclal-core
[INFO] jclal-spark
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building JCLAL framework 2.0
@ragnarok22
ragnarok22 / mnist_dl4j.java
Created June 13, 2018 16:25
sample code in DL4J and MNIST dataset
String dataset_home = System.getProperty("user.home") + File.separator + "datasets" + File.separator;
String mnist_home = dataset_home + "mnist_png" + File.separator;
String trainPath = mnist_home + "training";
String testPath = mnist_home + "testing";
int numRows = 28; // height
int numColumns = 28; // width
int channels = 1; // depth
int outputNum = 10;
int batchSize = 128;
Exception in thread "main" java.lang.NoClassDefFoundError: com/github/os72/protobuf351/MessageOrBuilder
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:760)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
org.nd4j.linalg.exception.ND4JIllegalStateException: Failed to allocate [5913600000] bytes
at org.nd4j.linalg.cpu.nativecpu.CpuMemoryManager.allocate(CpuMemoryManager.java:35)
at org.nd4j.linalg.memory.abstracts.Nd4jWorkspace.alloc(Nd4jWorkspace.java:399)
at org.nd4j.linalg.memory.abstracts.Nd4jWorkspace.alloc(Nd4jWorkspace.java:299)
at org.nd4j.linalg.api.buffer.BaseDataBuffer.<init>(BaseDataBuffer.java:635)
at org.nd4j.linalg.api.buffer.FloatBuffer.<init>(FloatBuffer.java:65)
at org.nd4j.linalg.api.buffer.factory.DefaultDataBufferFactory.createFloat(DefaultDataBufferFactory.java:257)
at org.nd4j.linalg.factory.Nd4j.createBuffer(Nd4j.java:1481)
at org.nd4j.linalg.api.ndarray.BaseNDArray.<init>(BaseNDArray.java:261)
at org.nd4j.linalg.cpu.nativecpu.NDArray.<init>(NDArray.java:126)