Skip to content

Instantly share code, notes, and snippets.

View sebasjm's full-sized avatar
😀

Sebastian Javier Marchano sebasjm

😀
  • Buenos Aires, Argentina
View GitHub Profile
@sebasjm
sebasjm / gist:861255
Created March 8, 2011 22:35
list java/lang public classes in a jar file
public static void main(String args[]) throws IOException, ClassNotFoundException {
JarFile jarFile = new JarFile("/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Classes/classes.jar");
Enumeration allEntries = jarFile.entries();
while (allEntries.hasMoreElements()) {
JarEntry entry = (JarEntry) allEntries.nextElement();
String name = entry.getName();
if (name.startsWith("java/lang") && !name.substring(10).contains("/") && !name.contains("$")) {
int value = JarDir.class.getClassLoader().loadClass(name.substring(0, name.length() - 6).replace("/", ".")).getModifiers();
if (Modifier.isPublic(value)) {
System.out.print(name.substring(10,name.length()-6) + "|");
@sebasjm
sebasjm / geloc.html
Created September 7, 2012 16:58
geoloc
<!-- GEO LOC -->
<script type="text/javascript" src="https://maps.google.com/maps/api/js?sensor=true"></script>
<input id="ubicacion" type="text" value="" /> &nbsp; <a href="javascript:confirmar_ubicacion()"> confirmar ubicación </a>
<script>
// new google.maps.Geocoder().geocode({'address':'buenos aires'},function(r,s){$('#personal-data-location-input').html(pepe(r[0].formatted_address));})
function confirmar_ubicacion(){
var geocoder = new google.maps.Geocoder();
var ubicacion = $('#ubicacion').val();
if (!ubicacion || ubicacion == "") console.log( "Something went wrong");
@sebasjm
sebasjm / lambda_test.sh
Created October 2, 2012 01:35
goodbay java, hello c++ (again)
echo '
#include <iostream>
#include <string>
using namespace std;
int main() {
string x = "Hello";
auto say_hi = [x] (string y) { return x + " lambda " + y; };
cout << say_hi("world") << endl;
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCfnJlBmeUumnYBiqTqgfB4Mh8fsTUOWQyOg2GauuZMLWS+ZnP9z0aj1uDlgmRT0n79Bl0YIJep1iQzcyF+0GVhAhXptcYNIuKqLupkg0ysfeUqYACdPjZf+p8NTUofyBzhy/OJbfj7Wf12bq9FCE3IGAs2BIgkTtBWI0SdU17tI7w2ylCIAKrw+9JhmDGT4fi6VY20vYw5mOFh4ab7lADynEaOkAtzOqspOMFhkwYaAXUIa3UOwK88+wUXRR7evKZ7XY8orFMCXffvFhjy4rJ86Xs9ydamRSnTBTzWDN4vmftuNpaquWi6tvG9NyXPh883Kq8gXZERINZ7OVLLyt0v smarchano@donsatur
@sebasjm
sebasjm / incremental.sh
Last active August 29, 2015 14:27
incremental javac with inotify & maven
function log(){
echo [status] $(date +%x-%X) $@
}
log install
mvn clean install || exit 1
log copy deps
mvn dependency:copy-dependencies || exit 1
log ready
inotifywait $(find src/main/java -type f) -m -e close_write | while read file op; do
Verifying that +sebasjm is my blockchain ID. https://onename.com/sebasjm
[user]
name = Sebastian Javier Marchano
email = <email>
[color]
branch = auto
diff = auto
status = auto
[color "branch"]
current = yellow reverse
@sebasjm
sebasjm / README.md
Last active December 13, 2017 19:19
update docker swark service through ssh tunnel

Usage

sh $ DEPLOY_HOST=host.amazonaws.com DEPLOY_PRIVATE_KEY="$(cat id_rsa)" npx https://gist.github.com/sebasjm/18588bf1f49c48204361f78e260e1bae <service-name> <image-name>

#!/usr/bin/env node
require('https').get(`https://crt.sh/?q=%.${procces.argv[2]}&output=json`, resp => {
let data = ''
resp.on('data', chunk => {data += chunk;});
  resp.on('end', () => {
    const json = JSON.parse('['+data.split('}{').join('},{')+']');
const domains = json.map( j => j.name_value ).sort().filter( (i,p,a) => !p || i != a[p-1] )
domains.forEach( d => {
#!/usr/bin/env node
require('https').get(`https://crt.sh/?q=%.${process.argv[2]}&output=json`, resp => {
let data = ''
resp.on('data', chunk => {data += chunk;});
resp.on('end', () => {
const json = JSON.parse('['+data.split('}{').join('},{')+']');
const domains = json.map( j => j.name_value ).sort().filter( (i,p,a) => !p || i != a[p-1] )
domains.forEach( d => {