Skip to content

Instantly share code, notes, and snippets.

View so77id's full-sized avatar
👶
Father in process

Miguel Rodriguez so77id

👶
Father in process
  • Santiago, Chile
View GitHub Profile
@so77id
so77id / container_gpu.py
Last active August 14, 2018 22:59
Get the container name of each process running in each gpu
import subprocess
import collections
gpus = subprocess.check_output("nvidia-smi | grep ' C' | awk '{print $2}'", shell=True).split('\n')[:-1]
gpids = subprocess.check_output("nvidia-smi | grep ' C' | awk '{print $3}'", shell=True).split('\n')[:-1]
cnames = subprocess.check_output("docker ps -q | xargs docker inspect --format '{{.State.Pid}} {{.Name}}' | awk '{print $2}'", shell=True).split('\n')[:-1]
cpids = subprocess.check_output("docker ps -q | xargs docker inspect --format '{{.State.Pid}} {{.Name}}' | awk '{print $1}'", shell=True).split('\n')[:-1]
# Updade and fix brew
echo "[Update] brew"
brew update && brew doctor
# Build-essentials
brew install autoconf
brew install automake
brew install libtool
@so77id
so77id / download_files.sh
Last active March 25, 2020 05:04
used in naxnet code review
if [ "$#" -eq 0 ]; then
myArray=( )
else
urls=( $1 )
names=( $2 )
src=$3
fi
for ((i=0;i<${#urls[@]};++i)); do
import os
import sys
import glob
import requests
def main():
url_result = sys.argv[1]
url_result_zip = "/".join(url_result.split("/")[0:-1] + ["result_zip"])
url_compilation_error = "/".join(url_result.split("/")[0:-1] + ["compilation_error"])
@so77id
so77id / Makefile
Created March 31, 2020 02:11
Java makefile for naxcode review
SRC=$(wildcard *.java)
OBJ=$(patsubst %.java, %, $(SRC))
CLASS=$(patsubst %.java, %.class, $(SRC))
CC=javac
IC=java
compile:
@$(CC) $(SRC) > compilation.out
clean:
@so77id
so77id / List.java
Created March 31, 2020 06:03
Example of ordered linked list in java
class List {
private Node head;
public List() {
this.head = null;
}
public void insert(int value){
Node n_node = new Node(value);
if (this.head == null) {
@so77id
so77id / Main.java
Created March 31, 2020 06:04
Example of stacks implemented over linked list in java
import java.util.Scanner; // Import the Scanner class
public class Main {
public static void main(String[] args){
int n, buff;
Node tmp;
Scanner scanner = new Scanner(System.in); // Create a Scanner object
Stack myStack = new Stack();
@so77id
so77id / Main.java
Created March 31, 2020 06:05
Example of queue implemented over linked list in java
import java.util.Scanner; // Import the Scanner class
public class Main {
public static void main(String[] args){
int n, buff;
Node tmp;
Scanner scanner = new Scanner(System.in); // Create a Scanner object
Queue myQueue = new Queue();
@so77id
so77id / HeapExample.java
Created April 17, 2020 22:23
Heap example
import java.util.Scanner; // Import the Scanner class
import java.util.Comparator;
public class HeapExample {
public static class Heap<Key> {
private Key[] data;
private int n;
private int size;
private Comparator cmp;
@so77id
so77id / StackExample.java
Created April 17, 2020 22:24
Stack example in java
import java.util.Scanner; // Import the Scanner class
import java.util.Stack;
public class StackExample {
public static void main(String[] args){
int n;
String buff;
Scanner scanner = new Scanner(System.in); // Create a Scanner object
Stack<String> stack = new Stack<String>();