Skip to content

Instantly share code, notes, and snippets.

View cocodrino's full-sized avatar
🏠
Working from home

carlos L cocodrino

🏠
Working from home
  • Venezuela
View GitHub Profile
@cocodrino
cocodrino / gist:e4482d7f00eed25b9db9475cc9d3d606
Created July 30, 2019 01:47
make screenshoot command line
maim -s | xclip -selection clipboard -t image/png
@cocodrino
cocodrino / gist:b50b19b9d55a0c98c52611f334de2a49
Created June 11, 2019 12:19
bulk rename for files in zsh
I'd several files like
image.png
image-transparent.png
image3.png
image3-transparent.png
...lot files...
I needed rename and remplace for instance image-transparent.png for image.png
so in the folder
@cocodrino
cocodrino / gist:0eea5c328ef4b411911f927277f424b6
Created June 9, 2019 00:29
autorandr save your xrandr configuration or store differents profiles
Install with sudo apt install autorandr (tested on Ubuntu 18.04)
Configure your monitor to your liking with xrandr
Store your configuration with autorandr --save work (I'm storing my work config, choose a name that suits you)
Resume the config with autorandr --change work to choose config, or just autorandr --change to have it infer your config from your connected monitors.
XDG autostart .desktop is also provided, and installed into /etc/xdg/autostart/autorandr.desktop by default.
@cocodrino
cocodrino / sample.html
Created May 27, 2019 18:00
trick for load external javascript files valids with parceljs
<script>
function loadNonLocalScriptSync(href) {
var f=document.getElementsByTagName('script')[0],
j=document.createElement('script');
// Simulate <script> faithfully
j.async=false;
j.src=href;
f.parentNode.insertBefore(j,f);
};
@cocodrino
cocodrino / algo.js
Last active January 10, 2019 12:14
como usar promesas (versión rapida y pirata)
//con callbacks debes pasar el callback, cuyo argumento se va a resolver en un futuro...en el siguiente ejemplo el valor de database
//se resolverá en el futuro, luego book y luego user
connectDatabase(function(database){
findAllBooks(database,function(book){
getCurrentUser(database,function(user){
return pickTopRecommendation(books, user);
})
})
})
@cocodrino
cocodrino / file.js
Created December 8, 2018 03:00
promisify callback
function promisify(func) {
return (...args) =>
new Promise((resolve, reject) => {
const callback = (err, data) => err ? reject(err) : resolve(data)
func.apply(this, [...args, callback])
})
}
@cocodrino
cocodrino / download
Created November 1, 2018 02:48
download subfolder github
For other users who just want to download a file/folder from github, simply use:
svn export <repo>/trunk/<folder>
e.g.
svn export https://github.com/lodash/lodash.com/trunk/docs
(yes, that's svn here. apparently in 2016 you still need svn to simply download some github files)
Courtesy: Download a single folder or directory from a GitHub repo
@cocodrino
cocodrino / store.js
Created October 31, 2018 17:24
store
const ROOT_SOCKET = `wss://${URL}/socket`;
let socket = new Socket(ROOT_SOCKET);
socket.connect()
let chan = socket.channel("connect:" + guid());
chan.join();
and then I could create a mutation for load the callbacks and call this from my main component
someMutation(state) {
@cocodrino
cocodrino / get system info
Created October 30, 2018 16:17
get OS and system info linux arch
inxi -Fxxxz
@cocodrino
cocodrino / guide.txt
Created October 30, 2018 00:46
fix kernel panic arch
this works for me, not neccesary for you...but maybe could help
1) start with arch/manjaro live cd
2) update your packages with sudo pacman -Syy
3) install pacman -S arch-install-scripts
4) mount your partition with mount /dev/sda7 /mnt (in my case is sda7)
5) run arch-chroot /mnt/arch
6) run pacman -S linux
restart your machine!!!...and hopefully this will work