Skip to content

Instantly share code, notes, and snippets.

View juhnny5's full-sized avatar
:shipit:

Julien Briault juhnny5

:shipit:
View GitHub Profile
@un33k
un33k / sed cheatsheet
Created August 22, 2011 13:28
magic of sed -- find and replace "text" in a string or a file
FILE SPACING:
# double space a file
sed G
# double space a file which already has blank lines in it. Output file
# should contain no more than one blank line between lines of text.
sed '/^$/d;G'
@ckunte
ckunte / hosts
Last active March 17, 2021 11:02
A copy of /etc/hosts file for blocking tracking, unwanted, and offensive sites. I am grateful to Dan Pollock for this. An original copy can be found here: http://someonewhocares.org/hosts/
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
#::1 localhost
#fe80::1%lo0 localhost
@ssstonebraker
ssstonebraker / sed cheatsheet
Created August 2, 2013 14:06 — forked from un33k/sed cheatsheet
Sed Cheatsheet
FILE SPACING:
# double space a file
sed G
# double space a file which already has blank lines in it. Output file
# should contain no more than one blank line between lines of text.
sed '/^$/d;G'
@sandroqz
sandroqz / Vagrantfile
Created October 25, 2013 04:59
Vagrantfile with comments.
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.
# Every Vagrant virtual environment requires a box to build off of.
config.vm.box = "debian-7.2.0-amd64"
@adityamukho
adityamukho / 90-firewall.conf
Last active February 11, 2021 09:40
Secure an Arch Linux instance to run as a public server.
# /etc/sysctl.d/90-firewall.conf
# Turn on Source Address Verification in all interfaces to
# prevent some spoofing attacks
net.ipv4.conf.all.rp_filter=1
# Uncomment the next line to enable TCP/IP SYN cookies
net.ipv4.tcp_syncookies=1
net.ipv4.tcp_max_syn_backlog = 2048
net.ipv4.tcp_synack_retries = 2
@Janfy
Janfy / demo_dialog.sh
Created March 26, 2014 17:10
"dialog" linux command demonstration
#!/bin/bash
# Script de présentation de dialog
# demo_dialog.sh copyleft spi.marc 2004
# Source: http://lea-linux.org/documentations/Dev-dialog
# Pour découvrir dialog par la pratique :
# faites tourner ce script, examinez son code.
# Différentes boîtes de dialog sont ici présentées dans
@hectorperez
hectorperez / copy word under cursor in Vim.txt
Created August 7, 2014 13:37
copy word under cursor in Vim
copy/delete word under cursor in Vim
yw / byw
Assuming that the cursor is at the first character of the word simply do this in command mode:
yw
y is for yank and w is for word.
Other ways of doing the same thing which are not as efficient:
vey
the v starts visual select mode. e tells vim to move to end of word. y yanks or copies the word. to delete replace y with x.
@renzok
renzok / bash-template
Last active July 29, 2023 12:31
A template bash script based on google style guide with some little improvements
#!/bin/bash
# Here short description of this script
# This is just a template to be used for writing new bash scripts
###
# Based on Google Style Guide: https://google.github.io/styleguide/shell.xml
# General remarks
# * Executables should have no extension (strongly preferred) or a .sh extension.
# * Libraries must have a .sh extension and should not be executable
@rjeczalik
rjeczalik / main.go
Created November 18, 2014 09:29
go-exec: debugging os/exec with interactive scripts
package main
import (
"fmt"
"os"
"os/exec"
)
func die(v interface{}) {
fmt.Fprintln(os.Stderr, v)
@hoitomt
hoitomt / log_request.go
Created January 30, 2015 12:56
Golang: Log HTTP Requests in Go
package main
import (
"fmt"
"log"
"net/http"
"os"
)
func main() {