Skip to content

Instantly share code, notes, and snippets.

View dvdvideo1234's full-sized avatar
🤑
Baking rakia !

Deyan Dobromirov dvdvideo1234

🤑
Baking rakia !
View GitHub Profile
@Jekis
Jekis / toggle_swap.sh
Last active August 17, 2024 01:06
Empty swap. Clear swap. Move swap to RAM. Ubuntu.
#!/bin/bash
function echo_mem_stat () {
mem_total="$(free | grep 'Mem:' | awk '{print $2}')"
free_mem="$(free | grep 'Mem:' | awk '{print $7}')"
mem_percentage=$(($free_mem * 100 / $mem_total))
swap_total="$(free | grep 'Swap:' | awk '{print $2}')"
used_swap="$(free | grep 'Swap:' | awk '{print $3}')"
swap_percentage=$(($used_swap * 100 / $swap_total))
@iamgreaser
iamgreaser / gist:7128257
Created October 23, 2013 22:51
How to shoot yourself in the foot with Lua
function aim_and_fire(at)
target(at)
shoot()
end
print("Where do I shoot myself?")
target = io.read()
aim_and_fire(target)