Skip to content

Instantly share code, notes, and snippets.

View tun's full-sized avatar
🌊
learning

Ricardo Tun tun

🌊
learning
View GitHub Profile
@tun
tun / cloud-init-output.log
Last active March 30, 2019 09:15
cloud-config: docker+docker-compose+dry & other tools
Cloud-init v. 18.3-24-gf6249277-0ubuntu2~scaleway1 running 'init-local' at Thu, 28 Mar 2019 09:17:17 +0000. Up 19.75 seconds.
Cloud-init v. 18.3-24-gf6249277-0ubuntu2~scaleway1 running 'init' at Thu, 28 Mar 2019 09:17:20 +0000. Up 22.81 seconds.
ci-info: +++++++++++++++++++++++++++++++++++++++++Net device info+++++++++++++++++++++++++++++++++++++++++
ci-info: +----------+-------+-----------------------------+-----------------+--------+-------------------+
ci-info: | Device | Up | Address | Mask | Scope | Hw-Address |
ci-info: +----------+-------+-----------------------------+-----------------+--------+-------------------+
ci-info: | enp0s2 | True | 10.20.250.131 | 255.255.255.254 | global | de:2c:0c:32:c0:02 |
ci-info: | enp0s2 | True | fe80::dc2c:cff:fe32:c002/64 | . | link | de:2c:0c:32:c0:02 |
ci-info: | ip6_vti0 | False | . | . | . | . |
ci-info: | ip6tnl0 | False |
@tun
tun / mouse-clicks.js
Created April 21, 2018 02:36
jquery mouse clicks
$('body').mousedown(function(event) {
switch (event.which) {
case 1:
alert('Left Mouse button pressed.');
break;
case 2:
alert('Middle Mouse button pressed.');
break;
case 3:
alert('Right Mouse button pressed.');
@tun
tun / gh-pages.sh
Created December 27, 2017 03:27
gh-pages git worktree
git checkout --orphan gh-pages
git commit --allow-empty -m "gh-pages branch worktree"
git checkout master
mkdir -p public/
git worktree add public/ gh-pages
@tun
tun / README.md
Last active December 13, 2017 07:44 — forked from willurd/ set-wallpaper.sh
Set the Desktop Background for all of your open Spaces in macOS High Sierra

Instructions

  1. Open Automator and create a new Service
  2. Set "Service receives selected" to "image files"
  3. Add a "Run Shell Script" action to the workflow, remove the default script contents, and paste the set-wallpaper.sh script into it
  4. Save as "Set as Wallpaper"

The service should then be available to you when right-clicking image files. Right-clicking an image file (png, jpg, etc) in the Finder and choosing "Set as Wallpaper" will set that image as the Desktop Background image for all open Spaces. No need to quit apps or delete Spaces!

You can use an app like [Services Manager][1] to organize your Finder context menus.

@tun
tun / remove_other_kernels.sh
Last active November 9, 2017 20:11
Force remove other kernels in order to clean up/free space in /boot partition (debian based distros)
sudo dpkg --force-all -P `for j in $(
for i in /boot/vmlinuz* ; do
dpkg -S $i| egrep -v $(uname -r)
done |cut -d- -f3-4 ) ;
do
dpkg -l "*$j*" | egrep '^ii|^rc'
done | awk '{print $2}'`
@tun
tun / free_ram.sh
Created September 1, 2017 20:20
Flush RAM
sync; echo 1 > /proc/sys/vm/drop_caches
@tun
tun / keybase.md
Last active October 3, 2017 22:38
keybase.md

Keybase proof

I hereby claim:

  • I am tun on github.
  • I am ricrdo (https://keybase.io/ricrdo) on keybase.
  • I have a public key whose fingerprint is F50B 15C1 431E B5B2 2A67 B1E0 43E9 9983 7FC1 1665

To claim this, I am signing this object:

@tun
tun / Makefile
Last active March 21, 2018 00:41
Makefile for python (version 2 or 3) http server
PYTHON_VERSION = python --version|awk '{print $2}'|cut -c -1
ifeq ($PYTHON_VERSION,2)
PYHTTP = python -m 'SimpleHTTPServer'
else
PYHTTP = python -m http.server
endif
serve:
$(PYHTTP)
@tun
tun / list_stored_procedures.sql
Last active December 31, 2015 21:49
List all stored procedures in a MS SQL database
SELECT ROUTINE_NAME, ROUTINE_DEFINITION, CREATED, LAST_ALTERED
FROM information_schema.routines
WHERE ROUTINE_TYPE = 'PROCEDURE'
ORDER BY ROUTINE_NAME ASC
@tun
tun / random_string.py
Created September 13, 2013 05:10
Generates random string
# -*- coding: utf-8 -*-
import string
import random
def random_string(size=6):
chars = (string.ascii_uppercase + string.ascii_lowercase + string.digits)
return ''.join(random.choice(chars) for x in range(size))