Skip to content

Instantly share code, notes, and snippets.

@holly
holly / cloud_front_ips.sh
Created June 5, 2022 15:01 — forked from kozakana/cloud_front_ips.sh
CloudFrontのIPアドレスを取得してnginxのset_real_ip_fromの形式で出力
curl -s "https://ip-ranges.amazonaws.com/ip-ranges.json" |jq -r '.prefixes | map(select(.service == "CLOUDFRONT").ip_prefix) | "set_real_ip_from" + " " + .[] + ";"'
@holly
holly / github-pandoc.css
Created March 1, 2022 14:09 — forked from dashed/github-pandoc.css
GitHub-like CSS for pandoc standalone HTML files (perfect for HTML5 output). Based on Marked.app's GitHub CSS. Added normalize.css (v2.1.3) in the prior to GitHub css.
/*! normalize.css v2.1.3 | MIT License | git.io/normalize */
/* ==========================================================================
HTML5 display definitions
========================================================================== */
/**
* Correct `block` display not defined in IE 8/9.
*/
@holly
holly / md_sync_call.sh
Created January 17, 2021 15:11 — forked from tagomoris/md_sync_call.sh
Run "check" about specified md device if it's status is "idle"
#!/bin/sh
TARGET_MD=$1
### call md verifying when idle.
######
# HOW TO USE
### md_sync_call.sh md0
error_exit() {
@holly
holly / method_missing.py
Created October 15, 2016 14:40 — forked from ukyo/method_missing.py
method missing in python
class MethodMissing(object):
def __getattr__(self, name):
try:
return self.__getattribute__(name)
except AttributeError:
def method(*args, **kw):
return self.method_missing(name, *args, **kw)
return method
def method_missing(self, name, *args, **kw):
@holly
holly / mysql_secure.sh
Created June 22, 2016 03:20 — forked from Mins/mysql_secure.sh
Automating mysql_secure_installation
#!/bin/bash
aptitude -y install expect
// Not required in actual script
MYSQL_ROOT_PASSWORD=abcd1234
SECURE_MYSQL=$(expect -c "
set timeout 10
@holly
holly / inotify.py
Created November 15, 2015 04:27 — forked from quiver/inotify.py
Python implementation of "IBM DeveloperWorks : Monitor Linux file system events with inotify"
import collections
import ctypes
import ctypes.util
# bit masks
IN_ISDIR = 0x40000000
IN_ALL_EVENTS = 0xfff
class inotify_event_struct(ctypes.Structure):
"""
@holly
holly / Check server
Last active August 29, 2015 14:16 — forked from Oneiroi/Check server
openssl s_client -cipher EXPORT -connect domain.com:443 < /dev/null 2>/dev/null | grep SSL-Session | wc -l
@holly
holly / getswap.sh
Last active April 8, 2023 14:22 — forked from koemu/getswap.sh
#!/bin/bash
# Get current swap usage for all running processes
# Erik Ljungstrom 27/05/2011
# Updated: 2013-11-13 Yuichiro Saito
SUM=0
OVERALL=0
for DIR in `find /proc/ -maxdepth 1 -type d | egrep "^/proc/[0-9]"` ; do
PID=`echo $DIR | cut -d / -f 3`
PROGNAME=`ps -p $PID -o comm --no-headers`
for SWAP in `grep Swap $DIR/smaps 2>/dev/null| awk '{ print $2 }'`
/*
This widget shows Recent Posts on your Tumblr blog.
Its dependency is jQuery.
Usage:
1) Add html:
<div id="recent-posts"></div>
2) Add code into the <head>: