Skip to content

Instantly share code, notes, and snippets.

View LuRsT's full-sized avatar
🎲
I like dice

Gil Gonçalves LuRsT

🎲
I like dice
View GitHub Profile
@LuRsT
LuRsT / headless_slimerjs.sh
Last active August 29, 2015 13:56
How to use slimerjs headless
#!/usr/bin/sh
startx -- `which Xvfb` :1 -screen 0 1024x768x24 2>>/dev/null &
VIRTUAL_X_PID=$!
echo "Virtual X started with PID: $VIRTUAL_X_PID"
DISPLAY=:1 slimerjs script.js
@LuRsT
LuRsT / smartjump_folder.sh
Last active August 29, 2015 14:07
Jump to the first directory with the name you input
cd $(find . -type d | grep "$1$" | head -1)
@LuRsT
LuRsT / smartjump_file.sh
Last active August 29, 2015 14:07
Jump to the first directory where a file with the name you input is
find . -type f | grep "$1$" | head -1 | xargs dirname
@LuRsT
LuRsT / README.md
Last active November 21, 2015 13:10
Browser script to view html code from the terminal to the browser

Browser

Inspired and based off of https://gist.github.com/defunkt/318247, since that script didn't work with my environment, I decided to improve on it.

Requirements

You need to have bash installed, but this was also tested in zsh so feel free to change the hashbang, apart from that the only thing you need to do is to set the $BROWSER environment variable.

$ export BROWSER="firefox" # or "chromium-browser" or "chrome" or any browser you want
@LuRsT
LuRsT / json_for_humans.py
Created February 27, 2015 12:38
Json for humans
from json import loads as json_decode
from json import dumps as json_encode
@LuRsT
LuRsT / Dockerfile
Created September 19, 2015 10:31
Dockerfile for `hr`
FROM debian
RUN apt-get update && apt-get install -y curl
RUN curl https://raw.githubusercontent.com/LuRsT/hr/master/hr > /bin/hr
RUN chmod +x /bin/hr

Keybase proof

I hereby claim:

  • I am lurst on github.
  • I am lurst (https://keybase.io/lurst) on keybase.
  • I have a public key ASDXWVXlJS3AZTrIuy8zkphJ5t7j8pAlYdHS_KGUq_DZOAo

To claim this, I am signing this object:

@LuRsT
LuRsT / loading_bar.py
Created December 13, 2016 11:22
Loading bar in Python 3
import time
for x in range(10):
time.sleep(1)
print("Progress {:2.1%}".format(x / 10), end="\r")
@LuRsT
LuRsT / list_comprehensions.py
Last active March 17, 2017 10:52
List Comprehensions in Python
# Why list comprehensions?
fruits = ['orange', 'apple', 'pineapple']
things = ['potato', 'orange', 'car', 'apple']
# This will filter things and will create a new list with only fruits from
# things
new_list_of_things = []
for thing in things:
if thing in fruits:
@LuRsT
LuRsT / 10commands.md
Last active August 23, 2019 13:51
10 Command-ments talk