Skip to content

Instantly share code, notes, and snippets.

View djromero's full-sized avatar
⌨️
Working

Julián Romero djromero

⌨️
Working
  • Job&Talent
  • Madrid (Spain)
View GitHub Profile
@djromero
djromero / most_allocated_objects.rb
Created October 16, 2022 09:31 — forked from JoshCheek/most_allocated_objects.rb
Finding locations of most allocated objects
require 'objspace'
def self.show_allocations(&block)
_ = ObjectSpace.trace_object_allocations &block
ObjectSpace
.each_object
.to_a
.filter_map do |obj|
file = ObjectSpace.allocation_sourcefile obj
line = ObjectSpace.allocation_sourceline obj
@djromero
djromero / pycurses.py
Created January 25, 2020 22:49 — forked from claymcleod/pycurses.py
Python curses example
import sys,os
import curses
def draw_menu(stdscr):
k = 0
cursor_x = 0
cursor_y = 0
# Clear and refresh the screen for a blank canvas
stdscr.clear()
@djromero
djromero / sendmail_setup.md
Created March 26, 2018 17:39 — forked from kany/sendmail_setup.md
Setup SENDMAIL on Mac OSX Yosemite
@djromero
djromero / upload-github-release-asset.sh
Created May 27, 2017 15:30 — forked from stefanbuck/upload-github-release-asset.sh
Script to upload a release asset using the GitHub API v3.
#!/usr/bin/env bash
#
# Author: Stefan Buck
# https://gist.github.com/stefanbuck/ce788fee19ab6eb0b4447a85fc99f447
#
#
# This script accepts the following parameters:
#
# * owner
# * repo
@djromero
djromero / Linux Static IP
Created December 27, 2016 19:51 — forked from fernandoaleman/Linux Static IP
How To Configure Static IP On CentOS 6
## Configure eth0
#
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
NM_CONTROLLED="yes"
ONBOOT=yes
HWADDR=A4:BA:DB:37:F1:04
TYPE=Ethernet
BOOTPROTO=static
@djromero
djromero / perfectelementary.bash
Created June 6, 2016 10:28
HowTo Install the perfect Elementary-OS
#Download Elementary OS from here:
#http://sourceforge.net/projects/elementaryos/files/stable/
#First you update your system
sudo apt-get update && sudo apt-get dist-upgrade
#Install Google Chrome
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
sudo sh -c 'echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list'
@djromero
djromero / channel.swift
Last active January 18, 2018 22:31 — forked from seanlilmateus/channel.swift
golang like channels in swift
import XCPlayground
import Foundation
import UIKit
class Channel<T>
{
var stream: Array<T>
let queue: dispatch_queue_t
let semaphore: dispatch_semaphore_t
@djromero
djromero / Tuple+Generator.swift
Created January 31, 2016 18:12 — forked from jverkoey/Tuple+Generator.swift
Tuple enumeration
/** The returned generator will enumerate each value of the provided tuple. */
func generatorForTuple(tuple: Any) -> AnyGenerator<Any> {
return anyGenerator(Mirror(reflecting: tuple).children.lazy.map { $0.value }.generate())
}
// Blogged at http://design.featherless.software/enumerating-tuple-values-swift/
#!/usr/bin/env bash
apt-get -y update
apt-get -y upgrade
apt-get -y install build-essential zlib1g-dev libssl-dev libreadline-gplv2-dev libyaml-dev libffi-dev libjemalloc-dev
apt-get -y install autoconf curl bzip2
apt-get -y autoremove
apt-get -y clean
cd /usr/local/src
curl http://cache.ruby-lang.org/pub/ruby/2.2/ruby-2.2.2.tar.gz
/*
2013-09-29 21:23:26.468 perf[3911:60b] Sep 26, 2013, 8:47 AM confidence high type walking steps 16
2013-09-29 21:23:26.474 perf[3911:60b] Sep 26, 2013, 8:56 AM confidence medium type walking steps 0
2013-09-29 21:23:26.492 perf[3911:60b] Sep 26, 2013, 9:08 AM confidence high type stationary steps 25
...
*/
if([CMMotionActivityManager isActivityAvailable]) {
CMMotionActivityManager *cm = [[CMMotionActivityManager alloc] init];
CMStepCounter *sc = [[CMStepCounter alloc] init];