Skip to content

Instantly share code, notes, and snippets.

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

Alberto Schiabel jkomyno

🏠
Working from home
View GitHub Profile
@jkomyno
jkomyno / gist:a0c88b9aa455c544bb7c2c92dbe3534b
Created April 1, 2016 14:58 — forked from marty-wang/gist:5a71e9d0a6a2c6d6263c
Compile and deploy React Native Android app of Release version to device.
Disclaimer: The instructions are the collective efforts from a few places online.
Nothing here is my original. But I want to put them together in one place to save people from spending the same time as I did.
First off, bundle.
==================
1. cd to the project directory
2. Start the react-native packager if not started
3. Download the bundle to the asset folder:
curl "http://localhost:8081/index.android.bundle?platform=android" -o "android/app/src/main/assets/index.android.bundle"
@jkomyno
jkomyno / compute_input.py
Created July 24, 2016 22:15
Basic NodeJS - Python CGI using inner module child_process
import sys, json, numpy as np
#Read data from stdin
def read_in():
lines = sys.stdin.readlines()
#Since our input would only be having one line, parse our JSON data from that
return json.loads(lines[0])
def main():
#get our data as an array from read_in()
@jkomyno
jkomyno / xmlOldCompliant.sh
Created August 5, 2016 08:25
This bash line will find any occurence of <Tag /> and will replace it by <Tag></Tag>
cat file.xml | sed -e "s/<\([^>]*\) \/>/<\1><\/\1>/g" > newfile.xml
@jkomyno
jkomyno / threeArraySort.js
Created August 31, 2016 12:20
Utility to sort three correlated array by merging them temporarily into objects. This utility sorts according to srttList (the third array).
function threeArraySort(ipList, macList, srttList) {
var list = [];
for (var j in ipList)
list.push({'ip': ipList[j], 'mac': macList[j], 'srtt': srttList[j] });
list.sort(function(a, b) {
return ((a.srtt < b.srtt) ? -1 : ((a.srtt == b.srtt) ? 0 : 1));
});
for (var k = 0; k < list.length; k++) {
Found Xcode project YourAwesomeProject.xcodeproj
Launching iPhone 6 (10.0)...
Building using "xcodebuild -project YourAwesomeProject.xcodeproj -scheme YourAwesomeProject -destination id=2DE46585-1211-49CB-B5E2-AC3AF7777C3C -derivedDataPath build"
User defaults from command line:
IDEDerivedDataPathOverride = /Users/jkomyno/dev/YourAwesomeProject/ios/build
=== BUILD TARGET RCTLinking OF PROJECT RCTLinking WITH CONFIGURATION Debug ===
Check dependencies
@jkomyno
jkomyno / get-wmi.sh
Last active September 16, 2016 09:01
#!/bin/bash
cd /data/tools/
wget http://www.openvas.org/download/wmi/wmi-1.3.14.tar.bz2
bzip2 -cd wmi-1.3.14.tar.bz2 | tar xf -
cd wmi-1.3.14/
sudo make "CPP=gcc -E -ffreestanding"
sudo cp Samba/source/bin/wmic /usr/local/bin/
Summary:
Support for GTK+ frontends: no (install gtk,gconf)
Support for SSL in SWAT and LDAP: no (install GNUTLS)
Support for threads in smbd (see --with-pthread): no (install PTHREAD)
Support for intelligent command line editing: no (install READLINE)
Support for changing process titles (see --with-setproctitle): no (install SETPROCTITLE)
Support for using extended attributes: yes
Support for using libblkid: no (install BLKID)
Support for using iconv: yes
String.prototype.replaceAll = function(search, replacement) {
return this.split(search).join(replacement)
};
export function doesNetworkAlreadyExist(singleNetwork, globalNetworksRange) {
let arr = globalNetworksRange.map(network => network.ip);
let str = arr.join(",");
return str.indexOf(singleNetwork) !== -1
}
@jkomyno
jkomyno / smartbind.jsx
Created September 21, 2016 08:42
No more fatigue binding methods in ReactJS
class BaseComponent extends React.Component {
_bind(...methods) {
methods.forEach( (method) => this[method] = this[method].bind(this) );
}
}
class ExampleComponent extends BaseComponent {
constructor() {
super();
this._bind('_handleClick', '_handleFoo');
@jkomyno
jkomyno / sockaddr_tostr.h
Last active December 20, 2023 00:50
Convert a struct sockaddr address to a string, IPv4 and IPv6
// Convert a struct sockaddr address to a string, IPv4 and IPv6:
char *get_ip_str(const struct sockaddr *sa, char *s, size_t maxlen)
{
switch(sa->sa_family) {
case AF_INET:
inet_ntop(AF_INET, &(((struct sockaddr_in *)sa)->sin_addr),
s, maxlen);
break;