Skip to content

Instantly share code, notes, and snippets.

@johnnypea
johnnypea / useful-one-liners.sh
Last active April 22, 2024 14:56
Useful one liners
# Run the last command as root
sudo !!
# Serve current directory tree at http://$HOSTNAME:8000/
python -m SimpleHTTPServer
# Save a file you edited in vim without the needed permissions
:w !sudo tee %
# change to the previous working directory
cd -
# Runs previous command but replacing
^foo^bar
@Davnit
Davnit / pulse.py
Created July 22, 2019 16:54
Decrypts and prints incident information from PulsePoint
import base64
import hashlib
import json
from urllib import request
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
from cryptography.hazmat.backends import default_backend
@uGeek
uGeek / INSTALL.md
Created July 13, 2019 19:54
A simple script to control the temperature of our raspberry pi. This script save the temperature in a log file and if it's greater than 70 ºC, our raspberry will be shutdown for security

INSTALL

The installation is very easy. First, you need to download the file below: checkTemp.sh. To complet this task, open a terminal an execute this command:

wget https://gist.github.com/Angelmmiguel/e13fed981e91bf6a298c/raw/0c33849753f17bd3b70d3aa2a4cfc06e05abafb3/checktemp.sh

The second step is to copy this file to the Crontab folder (Crontab is an application to schedule scripts in Unix systems):

sudo cp checktemp.sh /etc/cron.d/

The last step is to initialize the crontab task. You must open the crontab file to save the task with this command:

@solepixel
solepixel / select-state-v1.php
Created August 29, 2015 13:34
PHP States Select
<?php
<select name="state" id="state">
<option value=""<?php if(!isset($_POST['state']) || $_POST['state'] == ""){ ?> selected="selected"<?php } ?>>Select One</option>
<option value="AL"<?php if($_POST['state'] == "AL"){ ?> selected="selected"<?php } ?>>Alabama</option>
<option value="AK"<?php if($_POST['state'] == "AK"){ ?> selected="selected"<?php } ?>>Alaska</option>
<option value="AZ"<?php if($_POST['state'] == "AZ"){ ?> selected="selected"<?php } ?>>Arizona</option>
<option value="AR"<?php if($_POST['state'] == "AR"){ ?> selected="selected"<?php } ?>>Arkansas</option>
<option value="CA"<?php if($_POST['state'] == "CA"){ ?> selected="selected"<?php } ?>>California</option>
<option value="CO"<?php if($_POST['state'] == "CO"){ ?> selected="selected"<?php } ?>>Colorado</option>
<option value="CT"<?php if($_POST['state'] == "CT"){ ?> selected="selected"<?php } ?>>Connecticut</option>
@joeguilmette
joeguilmette / Web Development Contract.md
Last active August 4, 2023 09:06 — forked from malarkey/Contract Killer 3.md
Web Development Contract

Web Design Contract

Based on Contract Killer, an open-source contract for web developers.

Summary:

I’ll always do my best to fulfill your needs and meet your expectations, but it’s important to have things written down so that we both know what’s what, who should do what and when, and what will happen if something goes wrong. In this contract you won’t find any complicated legal terms or long passages of unreadable text. I have no desire to trick you into signing something that you might later regret. What I do want is what’s best for both parties, now and in the future.

So in short;

You ([CLIENT COMPANY]), located at [CLIENT ADDRESS] are hiring me ([DEVELOPER]) located at [DEVELOPER ADDRESS] to design and develop a web site for the estimated total price of [QUOTE] as outlined in our previous correspondence.

@mietek
mietek / set-up-l2tp-ipsec-vpn-on-debian.md
Last active October 22, 2023 12:25
Set up L2TP/IPsec VPN on Debian

Set up L2TP/IPsec VPN on Debian

Set up IPsec

Set up networking

@martezr
martezr / Guacamole_Installer
Last active March 23, 2017 03:30
Guacamole HTML5 Gateway Installation Script
#!/bin/bash
#Guacamole 0.9.0 Installation Script
#Versioning Variables
guacamoleclientdownload = "http://sourceforge.net/projects/guacamole/files/current/binary/guacamole-0.9.0.war"
guacamoleserverdownload = "http://sourceforge.net/projects/guacamole/files/current/source/guacamole-server-0.9.0.tar.gz"
guacamoleservertar = "guacamole-server-0.9.0.tar.gz"
guacamoleserversource = "guacamole-server-0.9.0"
guacamoleclientwar = "guacamole-0.9.0.war"
@Adyg
Adyg / Avconv & Imagemagick CPU limit
Last active November 17, 2015 16:51
CPU limit for avconv and imagemagick convert
#limit imagemagick convert to 40% cpu
cpulimit -l 40 -e convert.im6
#limit avconv to 40% cpu
cpulimit -l 40 -e avconv
#build transition images. nice -n to ensure nothing stalls because of it
nice -n 19 convert img1.jpg img2.jpg -delay 10 -morph 200 tmp_zl.png
#build video from transition images. again note "nice -n"
@rrosiek
rrosiek / install_mysql.sh
Last active June 5, 2023 07:08
Vagrant provision script for php, Apache, MySQL, phpMyAdmin, Laravel, and javascript helpers. Tested with Ubuntu 16.04.
#! /usr/bin/env bash
###
#
# install_mysql.sh
#
# This script assumes your Vagrantfile has been configured to map the root of
# your application to /vagrant and that your web root is the "public" folder
# (Laravel standard). Standard and error output is sent to
# /vagrant/vm_build.log during provisioning.
@keesvanbochove
keesvanbochove / gist:4319624
Created December 17, 2012 16:29 — forked from Cosmicist/gist:3860074
Use this script as git pre-commit hook to automatically minify JS and CSS files in a Grails project (specifically GSCF in this case, https://github.com/thehyve/GSCF). Installation instructions: put this text in .git/hooks/pre-commit, and make it executable (shmod +x pre-commit). Also, install yuicompressor, e.g. via 'brew install yuicompressor' …
#!/bin/bash
# Search YUI Compressor anywhere in your home dir
echo "Searching for YUI Compressor..."
YUIC=`which yuicompressor`
if ! [ $YUIC ]
then
echo "Unable to find YUI Compressor! Goodbye!"
exit
fi