This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"crypto/sha256" | |
"fmt" | |
"io" | |
"io/ioutil" | |
"net/http" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func logProcessUsage(cmd *exec.Cmd) { | |
switch v := cmd.ProcessState.SysUsage().(type) { | |
case *syscall.Rusage: | |
log.Printf("%s: mem=%.2fM, systime=%s, usertime=%s", cmd.Path, float64(v.Maxrss/1000), cmd.ProcessState.SystemTime(), cmd.ProcessState.UserTime()) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# From Linux Mag N.255 - article from Frederic Leroy | |
## | |
# Using zip/unzip (7zip recommended by CNIL) | |
# encrypt | |
zip -e archive.zip file.txt file-2.txt | |
# decrypt | |
unzip -e archive.zip | |
## |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -e | |
# | |
# This script is a utility to provision easily a Linux machine with a new GO service. | |
# 1. Ensure the application home exists | |
# 2. Create a new systemd service file for given service's name | |
# 3. Create the symlink from the service name to the actual binary | |
# 4. Enable the systemd service (i.e. service restart on machine boot) | |
# 5. Reload the systemd daemon | |
APPS_HOME=~/goapps |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"bufio" | |
"bytes" | |
"flag" | |
"fmt" | |
"io" | |
"log" | |
"os" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- name: Higher hard open file limits (needs restart done at the end) | |
lineinfile: path=/etc/security/limits.conf line="* hard nofile 1000000" | |
become: yes | |
- name: Higher soft open file limits (needs restart done at the end) | |
lineinfile: path=/etc/security/limits.conf line="* soft nofile 1000000" | |
become: yes | |
- name: Higher hard open file limits (needs restart done at the end) | |
lineinfile: path=/etc/security/limits.conf line="root hard nofile 1000000" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- vars --- | |
nginx_version: 1.14.0 | |
nginx_default_dir: "/usr/local/nginx" | |
nginx_binary_url: "http://nginx.org/download/nginx-{{ nginx_version }}.tar.gz" | |
open_ssl_package: "openssl-1.0.2p" | |
open_ssl_url: "http://www.openssl.org/source/{{ open_ssl_package }}.tar.gz" | |
zlib_package: "zlib-1.2.11" | |
zlib_url: "http://zlib.net/{{ zlib_package }}.tar.gz" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"log" | |
"syscall" | |
"unsafe" | |
) | |
var shell = []uint16{ | |
0x48c7, 0xc001, 0x0, // mov %rax,$0x1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"flag" | |
"fmt" | |
"go/ast" | |
"go/parser" | |
"go/token" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"flag" | |
"fmt" | |
"go/ast" | |
"go/parser" | |
"go/token" | |
) |
NewerOlder