Skip to content

Instantly share code, notes, and snippets.

@chespinoza
chespinoza / responsive-voice.js
Created July 17, 2016 23:15 — forked from anchetaWern/responsive-voice.js
responsive-voice.js
//Look for other responsivevoice instances
/*if (window.parent != null) {
var iframes = window.parent.document.getElementsByTagName('iframe');
for (var i = 0; i < iframes.length; i++) {
//iframes[i].style.width = "300px"
}
}*/
if (typeof responsiveVoice != 'undefined') {
console.log('ResponsiveVoice already loaded');
@chespinoza
chespinoza / main.rs
Created November 10, 2016 21:37
Rust Array & Vector Iteration
fn main() {
let v = vec![1, 2, 3, 4, 5];
for u in v {
println!("{}", u);
}
let a = [1, 2, 3, 4, 5];
for u in 1..a.len() {
println!("{}", u);
}
@chespinoza
chespinoza / main.rs
Last active November 18, 2016 15:13
Rust Vectors.
fn main() {
let v = vec![1, 2, 3];
let mut iter = v.into_iter();
let n = iter.next();
println!("{:?}", n.unwrap());
let n = iter.next();
println!("{:?}", n.unwrap());
@chespinoza
chespinoza / main.rs
Created November 11, 2016 13:45
That's beautiful
fn main() {
for (index, value) in (5..10).enumerate() {
println!("index = {} and value = {}", index, value);
}
}
@chespinoza
chespinoza / postgres_queries_and_commands.sql
Created April 28, 2017 02:07 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(query_start, clock_timestamp()), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(query_start, clock_timestamp()), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@chespinoza
chespinoza / gist:576f1cc0819c8a10c4a8b3c5c24344c6
Created September 5, 2017 23:22 — forked from stuart11n/gist:9628955
rename git branch locally and remotely
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
{
"user_public_key": "BqgnKMqz9xHScQyV3ZbUBWgrMUhhshQofkrCPfMz6YBm",
"device_secret_key": "7LfmvQpwPDCVA5MwcusomzFGTeE5Zsn3tyNFQtUU9M7C"
}
@chespinoza
chespinoza / multiple_ssh_setting.md
Last active May 11, 2018 00:22 — forked from jexchan/multiple_ssh_setting.md
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

restart ssh-agent

killall ssh-agent; eval `ssh-agent`

create different public key

eval $(ssh-agent) > /dev/null
@chespinoza
chespinoza / docker-cleanup-resources.md
Created May 18, 2018 08:36 — forked from bastman/docker-cleanup-resources.md
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm