Skip to content

Instantly share code, notes, and snippets.

View henri's full-sized avatar
💭
hacking the mainframe

henri henri

💭
hacking the mainframe
View GitHub Profile
@penguinwokrs
penguinwokrs / log_erase.sh
Created October 23, 2018 02:57
ログ消し
rm -f /var/log/lastlog-*
rm -f /var/log/maillog-*
rm -f /var/log/messages-*
rm -f /var/log/secure-*
rm -f /var/log/spooler-*
rm -f /var/log/tallylog-*
rm -f /var/log/wtmp-*
rm -f /var/log/yum.log-*
rm -f /var/log/lastlog-*
rm -f /var/log/maillog-*
@kdubau
kdubau / macOS-ISO-howto.md
Created September 24, 2018 17:57
How to create a bootable ISO of macOS install application.

Download

First download the install app bundle. Older versions can be hard to find but the current version of the time you read this, can be found in the App Store.

Create and attach a drive wtih hdiutil

To create a drive run this command: hdiutil create -o /tmp/Mojave.cdr -size 6200m -layout SPUD -fs HFS+J.
Next you will need to mount that drive hdiutil attach /tmp/Mojave.cdr.dmg -noverify -mountpoint /Volumes/install_build.

Create installation media in the new drive

Use the downloaded app bundle to create the media: sudo /Applications/Install\ macOS\ Mojave.app/Contents/Resources/createinstallmedia --volume /Volumes/install_build.

@voltechs
voltechs / no_automount
Last active November 18, 2022 01:29
Add volume (UUID) to fstab to prevent automount (macOS)
#!/usr/bin/env ruby
# Usage: no_automount /Volumes/My\ Disk
diskinfo = `diskutil info '#{ARGV[0]}'`.gsub("\n\n", "\n").split("\n").collect { |b|
b.strip.split(/:\s+/)
}.to_h
disk_uuid = diskinfo['Volume UUID']
disk_type = diskinfo['Type (Bundle)']
@mhubig
mhubig / Dockerfile
Last active November 3, 2023 03:42
Alpine Linux based cronjob runner
FROM alpine:latest
RUN apk add --update php python py-pip mysql-client \
&& pip install awscli \
&& rm -rf /var/cache/apk/*
RUN touch crontab.tmp \
&& echo '* */6 * * * /usr/bin/php /var/www/partkeepr/app/console partkeepr:cron:run' > crontab.tmp \
&& echo '0 2 * * * /usr/bin/sql_backup' >> crontab.tmp \
&& crontab crontab.tmp \
@bmaupin
bmaupin / build-openssl.sh
Last active December 11, 2023 20:24
Build openssl (with SSLv2/3 support for security testing)
#!/bin/bash
# Cache sudo password
sudo -v
# Get latest OpenSSL 1.0.2 version from https://openssl.org/source/
# v1.1.0 seems to have removed SSLv2/3 support
openssl_version=1.0.2k
# Install build dependencies
@jjnilton
jjnilton / mac-network-commands-cheat-sheet.md
Last active May 31, 2024 17:19
Mac Network Commands Cheat Sheet

Disclaimer: I'm not the original author of this sheet, but can't recall where I found it. If you know the author, please let me know so I give the attribution.

The original author seems to be Charles Edge, here's the original content, as pointed out by @percisely.

Note: Since this seems to be helpful to some people, I formatted it to improve readability of the original. Also, note that this is from 2016, many things may have changed, and I don't use macOS anymore, so I probably can't help in case of questions, but maybe someone else can.

Mac Network Commands Cheat Sheet

After writing up the presentation for MacSysAdmin in Sweden, I decided to go ahead and throw these into a quick cheat sheet for anyone who’d like to have them all in one place. Good luck out there, and s

@bryanzak
bryanzak / AccountRenamer.command
Created August 22, 2014 04:12
This is a script we have used for a while to rename an Active Directory user account that is cached locally. When a teacher has a name change, their AD short name changes, but not the user ID. OS X doesn't like this. So this script is run by our field techs from an admin account to simply rename the account from old to new. The teacher can then …
#!/bin/bash
# AccountRenamer.command
#
# Interactive tool to rename an account from one name to another (like when a teacher gets renamed and their e account changes)
#
# HISTORY:
#
# 1.0 2013-03-25 bmp - initial release
@scifiman
scifiman / gist:5109047
Created March 7, 2013 15:56
LaunchDaemon to check Adobe Flash version versus Apple's XProtect.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.company.xprotect_re-enable_adobe_flash</string>
<key>ProgramArguments</key>
<array>
<string>sh</string>
<string>/Library/Scripts/xprotect_re-enable_adobe_flash.sh</string>
@CocoaBeans
CocoaBeans / config.fish
Last active October 27, 2022 21:08
Fish shell custom prompt
########################################################################################
### Fish Custom Overrides
### Creates a shell prompt in the form of:
###
### ----------------------------------------------------------------------- 11:56:05
### kevin@kross /S/L/F/C/V/A/F/L/V/A/Support >
########################################################################################
set --global fish_prompt_username_color 555555
@MagerValp
MagerValp / 99-filtersecuredebug.sh
Created April 30, 2012 09:25
This removes lines containing passwordAsUTF8String in /var/log/secure.log*
#!/bin/bash
#
# This removes lines containing passwordAsUTF8String in /var/log/secure.log*
templog=`mktemp -t securelog`
for logfile in /var/log/secure.log*; do
echo "Filtering passwords from $logfile"
if [ ${logfile##*.} == "bz2" ]; then