Skip to content

Instantly share code, notes, and snippets.

@junxy
junxy / .wakeup
Last active June 14, 2018 02:40 — forked from ralph089/.wakeup
Restarts Bluetooth Module on Mac OS X. You can use the script as shortcut to restart Bluetooth on demand or you can use it with "SleepWatcher" to automatically restart Bluetooth on wakeup (See README.md). I created it, because my Logitech Bluetooth Mouse doesn't stay connected after sleep-mode, so i had to manually re-pair my mouse.
#!/bin/bash
#
# Restart Bluetooth Module on Mac OS X
#
# Requires Blueutil to be installed: http://brewformulas.org/blueutil
BT="/usr/local/bin/blueutil"
log() {
echo "$@"
@junxy
junxy / jdk1.8.0_151-install.txt
Last active April 28, 2020 13:19
Oracle JAVA -JDK Installation & Configuration Script 1.8.0_151
#//INSTRUCTIONS FOR DOWNLOADING AND INSTALLING JAVA WITHIN LINUX SYSTEMS AND UPDATING ALTERNATIVES FILES
#// rpm Installation Oracle JDK 1.8.0_151
wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie"  http://download.oracle.com/otn-pub/java/jdk/8u151-b12/e758a0de34e24606bca991d704f6dcbf/jdk-8u151-linux-x64.rpm
#// installation command
#// -i = install
#// -n = non-interactive
#// -v = verbose
#// -h = The hash table is a feature of bash that prevents it from having to search $PATH every time you type a command by caching the results in memory.
@junxy
junxy / fastonosql.rb
Last active December 14, 2017 03:58
fixes fastonosql .dmg file download 404 error. source: https://github.com/caskroom/homebrew-cask/blob/master/Casks/fastonosql.rb
cask 'fastonosql' do
version '1.10.0'
sha256 '38bf2c7b272040d8e25ec4cace4799c7a378bbf9e742192bff9d350e75d35292'
url "https://www.fastonosql.com/anonim_users_downloads/macosx/fastonosql-#{version}-x86_64.dmg"
appcast 'https://github.com/fastogt/fastonosql/releases.atom',
checkpoint: 'efc5b58bbfdeed9f028c65295b17774b0e5cb99548c160c91fa6a1085c3f13f4'
name 'FastoNoSQL'
homepage 'https://www.fastonosql.com/'
@junxy
junxy / CleanWindowTempCabFiles.ps1
Created December 2, 2016 02:41
清理 windows temp cab_* 临时文件? PS: 这些文件不断生成占用C盘空间,暂时没找到方法,删除也没发现有什么问题,只好先用脚本定期清理一下。
Set-Location "C:\Windows\Temp"
Get-ChildItem -Filter "cab_*" | Where-Object {$_.length -gt 1 }
Get-ChildItem -Filter "cab_*" | Where-Object {$_.length -gt 1 } | Remove-Item -Force
Write-Host "done"
@junxy
junxy / batch_ping.ps1
Created November 25, 2016 10:16
批量ping,并输出ping不通的ip
$stringlist =
'192.168.36.104',
'192.168.36.130',
'192.168.22.126',
'192.168.50.111',
'192.168.36.129',
'192.168.36.133'
# http://ilovepowershell.com/2010/04/13/powershell-how-to-ping-computers/
$ping = new-object system.net.networkinformation.ping
@junxy
junxy / Logstash-log4net-README.md
Last active July 14, 2020 07:15 — forked from dterziev/logstash.conf
Logstash 2.1.x config for log4net logs.
<!- .... ->
<log4net>    
    <appender name="RollingLogFileAppenderLogstash" type="log4net.Appender.RollingFileAppender">
      <encoding value="utf-8" />
      <!--该目录必需有 IIS用户 写权限-->
      <file value="X:/var/log/[app_name]/logfile.log" />
      <appendToFile value="true" />
      <rollingStyle value="Date" />
      <lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
@junxy
junxy / gist:d4f34e9e90f95b7ec29ace904259ee96
Last active April 20, 2016 03:45
https://library.octopusdeploy.com/#!/listing octopus deploy step template : Download file from url
{
"Id": "ActionTemplates-101",
"Name": "DownOutputScripts",
"Description": "Download file from url",
"ActionType": "Octopus.Script",
"Version": 4,
"Properties": {
"Octopus.Action.Package.NuGetFeedId": "feeds-builtin",
"Octopus.Action.Script.Syntax": "PowerShell",
"Octopus.Action.Script.ScriptSource": "Inline",
@junxy
junxy / Howto convert a PFX to a seperate .key & .crt file.md
Created March 23, 2016 05:37 — forked from TemporaryJam/Howto convert a PFX to a seperate .key & .crt file
How to convert a .pfx SSL certificate to .crt/key (pem) formats. Useful for NGINX

source: http://www.markbrilman.nl/2011/08/howto-convert-a-pfx-to-a-seperate-key-crt-file/

openssl pkcs12 -in [yourfile.pfx] -nocerts -out [keyfile-encrypted.key]

What this command does is extract the private key from the .pfx file. Once entered you need to type in the importpassword of the .pfx file. This is the password that you used to protect your keypair when you created your .pfx file. If you cannot remember it anymore you can just throw your .pfx file away, cause you won’t be able to import it again, anywhere!. Once you entered the import password OpenSSL requests you to type in another password, twice!. This new password will protect your .key file.

Now let’s extract the certificate:

openssl pkcs12 -in [yourfile.pfx] -clcerts -nokeys -out [certificate.crt]